From c33f3bc641f327adb65b2c98b1cdb166c9860e9d Mon Sep 17 00:00:00 2001 From: Vollstrecker Date: Sun, 1 Dec 2024 17:49:30 +0100 Subject: CMake: Move version setting for Cygwin into set_target_properties. --- CMakeLists.txt | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cd986b..28a4c3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,6 @@ include(CheckFunctionExists) include(CheckIncludeFile) include(CheckCSourceCompiles) include(GNUInstallDirs) -enable_testing() # # Check to see if we have large file support @@ -104,11 +103,19 @@ if(ZLIB_BUILD_SHARED) $<$:NO_FSEEKO> $<$:_CRT_SECURE_NO_DEPRECATE> $<$:_CRT_NONSTDC_NO_DEPRECATE>) + # The VERSION property causes shared libraries on Linux to have the full version + # encoded into their final filename. We disable this on Cygwin because + # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll + # seems to be the default. + # + # This has no effect with MSVC, on that platform the version info for + # the DLL comes from the resource file win32/zlib1.rc set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL SOVERSION 1 PROPERTIES OUTPUT_NAME z - PROPERTIES OUTPUT_NAME_DEBUG z${zlib_debug_suffix}) + PROPERTIES OUTPUT_NAME_DEBUG z${zlib_debug_suffix} + $<$:VERSION ${zlib_VERSION}>) if(UNIX AND NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) # On unix-like platforms the library is almost always called libz set_target_properties(zlib PROPERTIES @@ -136,17 +143,6 @@ if(ZLIB_BUILD_STATIC) PROPERTIES OUTPUT_NAME_DEBUG z${zlib_static_suffix}${zlib_debug_suffix}) endif(ZLIB_BUILD_STATIC) -if(NOT CYGWIN AND ZLIB_BUILD_SHARED) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # This has no effect with MSVC, on that platform the version info for - # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${zlib_VERSION}) -endif(NOT CYGWIN AND ZLIB_BUILD_SHARED) - if(ZLIB_INSTALL_LIBRARIES) if(ZLIB_BUILD_SHARED) install(TARGETS zlib -- cgit v1.2.3-55-g6feb