Commit 3e96807 for zlib
commit 3e9680762bf7e8c3fe710d1e99753e88abf009d3
Author: Vollstrecker <werner@vollstreckernet.de>
Date: Wed Dec 24 14:18:54 2025 +0100
CMake: Use components in minizip.
Check if minizip is part of zlib build.
diff --git a/contrib/minizip/CMakeLists.txt b/contrib/minizip/CMakeLists.txt
index 1aaf4ac..9f95a4e 100644
--- a/contrib/minizip/CMakeLists.txt
+++ b/contrib/minizip/CMakeLists.txt
@@ -44,6 +44,18 @@ if(NOT CPACK_INCLUDED)
include(CPack)
endif(NOT CPACK_INCLUDED)
+if(NOT DEFINED ZLIB_BUILD_MINIZIP)
+ if(MINIZIP_BUILD_SHARED)
+ list(APPEND REQUIRED_COMPONENTS "shared")
+ endif(MINIZIP_BUILD_SHARED)
+
+ if(MINIZIP_BUILD_STATIC)
+ list(APPEND REQUIRED_COMPONENTS "static")
+ endif(MINIZIP_BUILD_STATIC)
+
+ find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
+endif(NOT DEFINED ZLIB_BUILD_MINIZIP)
+
if(MINIZIP_ENABLE_BZIP2)
find_package(BZip2 REQUIRED)
endif(MINIZIP_ENABLE_BZIP2)
@@ -89,10 +101,6 @@ check_c_source_compiles(
unset(CMAKE_REQUIRED_FLAGS)
-if(NOT TARGET ZLIB::ZLIB)
- find_package(ZLIB REQUIRED CONFIG)
-endif(NOT TARGET ZLIB::ZLIB)
-
set(LIBMINIZIP_SRCS ioapi.c mztools.c unzip.c zip.c)
set(LIBMINIZIP_HDRS crypt.h ints.h ioapi.h mztools.h unzip.h zip.h)