Skip to content

Commit bd02b23

Browse files
committed
build: More changes to be robust for cmake 4.0
also, improve inline comments Signed-off-by: Zach Lewis <zachcanbereached@gmail.com>
1 parent 34ed8b0 commit bd02b23

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/cmake/build_ZLIB.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ build_dependency_with_cmake (ZLIB
8585
-D BUILD_SHARED_LIBS=${ZLIB_BUILD_SHARED_LIBS}
8686
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
8787
-D CMAKE_INSTALL_LIBDIR=lib
88+
# Fix for zlib breaking against cmake 4.0.
89+
# Remove when zlib is fixed to declare its own minimum high enough.
90+
-D CMAKE_POLICY_VERSION_MINIMUM=3.5
8891
${ZLIB_BUILD_OPTIONS}
8992
)
9093

src/cmake/externalpackages.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,19 @@ check_is_enabled(ZLIBNG ENABLE_ZLIBNG)
4444
check_is_enabled(ZLIB ALLOW_ZLIB)
4545

4646
if (ENABLE_ZLIBNG)
47+
# For zlib <= 1.3.1, we can differentiate between whether
48+
# find_package(ZLIB ...) finds zlib-ng or zlib with the CONFIG
49+
# or PREFER_CONFIG options.
4750
if (ALLOW_ZLIB)
51+
# Prefer zlib-ng if it's available, but fail over to zlib if it isn't.
4852
checked_find_package (ZLIB PREFER_CONFIG REQUIRED)
4953
else ()
50-
# This assumption will hold until zlib-1.3.2 is released.
5154
checked_find_package (ZLIB CONFIG REQUIRED)
5255
endif ()
5356
else ()
57+
# Starting v1.3.2, zlib will export CMake configs; so once zlib-1.3.2+
58+
# starts shipping with distros, we will have to re-evaluate how (and if)
59+
# we support "ignoring" compatibility-mode-zlib-ng in favor of system zlib.
5460
checked_find_package (ZLIB REQUIRED)
5561
endif ()
5662

0 commit comments

Comments
 (0)