From 3e9680762bf7e8c3fe710d1e99753e88abf009d3 Mon Sep 17 00:00:00 2001 From: Vollstrecker Date: Wed, 24 Dec 2025 14:18:54 +0100 Subject: CMake: Use components in minizip. Check if minizip is part of zlib build. --- contrib/minizip/CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/contrib/minizip/CMakeLists.txt b/contrib/minizip/CMakeLists.txt index 1aaf4ac7..9f95a4ee 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) -- cgit v1.2.3-55-g6feb