Skip to content

Commit

Permalink
Only when using Visual C++, the static library name should be "zlibst…
Browse files Browse the repository at this point in the history
…atic"

* On CygWin, MSYS and MinGW, the static library name should be "z" like on other Unix-like systems
  • Loading branch information
mtl1979 authored and Dead2 committed May 29, 2021
1 parent a3ed132 commit 2c65dce
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,24 @@ foreach(ZLIB_INSTALL_LIBRARY ${ZLIB_INSTALL_LIBRARIES})
endforeach()

if(WIN32)
set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME zlib${SUFFIX})
# Shared library
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
set_target_properties(zlib PROPERTIES OUTPUT_NAME zlib${SUFFIX})
endif()
# Static library
if(NOT DEFINED BUILD_SHARED_LIBS)
if(MSVC)
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX})
else()
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z${SUFFIX})
endif()
elseif(NOT BUILD_SHARED_LIBS)
if(MSVC)
set_target_properties(zlib PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX})
else()
set_target_properties(zlib PROPERTIES OUTPUT_NAME z${SUFFIX})
endif()
endif()
else()
# On unix-like platforms the library is almost always called libz
set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME z${SUFFIX})
Expand Down

0 comments on commit 2c65dce

Please sign in to comment.