]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
CMakeLists.txt: fix version in zlib.pc when building statically
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Fri, 27 May 2022 21:25:21 +0000 (23:25 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 17 Mar 2023 20:27:56 +0000 (21:27 +0100)
When building statically (i.e. with BUILD_SHARED_LIBS=OFF),
ZLIB_FULL_VERSION is not set resulting in an empty version in zlib.pc
and the following build failure with transmission:

checking for ZLIB... configure: error: Package requirements (zlib >= 1.2.3) were not met:

Package dependency requirement 'zlib >= 1.2.3' could not be satisfied.
Package 'zlib' has version '', required version is '>= 1.2.3'

Fixes:
 - http://autobuild.buildroot.org/results/b3b882482f517726e5c780ba4c37818bd379df82

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
CMakeLists.txt

index d65de6de5270f8e5dc544118e4620b67eb91b32f..4ec471a1465266993737d943952d12dc5c5d54d2 100644 (file)
@@ -130,8 +130,10 @@ if(ZLIB_COMPAT)
     add_definitions(-DZLIB_COMPAT)
     set(WITH_GZFILEOP ON)
     set(SUFFIX "")
+    set(ZLIB_FULL_VERSION ${ZLIB_HEADER_VERSION}.zlib-ng)
 else()
     set(SUFFIX "-ng")
+    set(ZLIB_FULL_VERSION ${ZLIBNG_HEADER_VERSION})
 endif()
 
 if(WITH_GZFILEOP)
@@ -1040,10 +1042,8 @@ if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
     set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
 
     if(ZLIB_COMPAT)
-        set(ZLIB_FULL_VERSION ${ZLIB_HEADER_VERSION}.zlib-ng)
         set_target_properties(zlib PROPERTIES SOVERSION 1)
     else()
-        set(ZLIB_FULL_VERSION ${ZLIBNG_HEADER_VERSION})
         set_target_properties(zlib PROPERTIES SOVERSION 2)
     endif()