Skip to content

Commit 72e8a29

Browse files
committed
build(zlib): ENABLE_ZLIB=1 permits building with zlib instead of zlib-ng
DISABLE_ZLIB=1 to only build against zlib-ng. DISABLE_ZLIBNG=1 will attempt to build against zlib instead of zlib-ng; but it will not necessarily _prevent_ building against zlib-ng.... Signed-off-by: Zach Lewis <zachcanbereached@gmail.com>
1 parent f7a5231 commit 72e8a29

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ LINKSTATIC = "1"
7373
# Standardize the install directory for libraries, as expected by
7474
# other parts of the wheels build process.
7575
CMAKE_INSTALL_LIBDIR = "lib"
76+
# Always build against zlib-ng (instead of regular zlib)
77+
DISABLE_ZLIB = "1"
7678

7779
# Dynamically set the package version metadata by pasrsing CMakeLists.txt.
7880
[tool.scikit-build.metadata.version]

src/cmake/externalpackages.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,20 @@ include (FindThreads)
3737
# Dependencies for required formats and features. These are so critical
3838
# that we will not complete the build if they are not found.
3939

40+
# ZLIB
41+
# We prefer zlib-ng to regular zlib, but we can use either.
42+
4043
check_is_enabled(ZLIBNG ENABLE_ZLIBNG)
44+
check_is_enabled(ZLIB ALLOW_ZLIB)
45+
4146
if (ENABLE_ZLIBNG)
42-
checked_find_package (ZLIB REQUIRED
43-
VERSION_MIN 2.2.4 # ZLIB-NG
44-
BUILD_LOCAL missing
45-
)
47+
if (ALLOW_ZLIB)
48+
checked_find_package (ZLIB PREFER_CONFIG REQUIRED)
49+
else ()
50+
checked_find_package (ZLIB CONFIG REQUIRED)
51+
endif ()
4652
else ()
47-
checked_find_package (ZLIB REQUIRED) # Needed by several packages
53+
checked_find_package (ZLIB REQUIRED)
4854
endif ()
4955

5056
# Help set up this target for libtiff config file when using static libtiff

0 commit comments

Comments
 (0)