diff options
-rw-r--r-- | Utilities/cmcurl/CMakeLists.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index f10a47d111..dcade3d101 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -588,7 +588,7 @@ endif() set(HAVE_LIBZ OFF) set(USE_ZLIB OFF) -optional_dependency(ZLIB) +find_package(ZLIB) if(ZLIB_FOUND) set(HAVE_LIBZ ON) set(USE_ZLIB ON) @@ -597,12 +597,16 @@ if(ZLIB_FOUND) # version of CMake. This allows our dependents to get our dependencies # transitively. if(NOT CMAKE_VERSION VERSION_LESS 3.4) - list(APPEND CURL_LIBS ZLIB::ZLIB) + if(CMAKE_USE_SYSTEM_ZLIB) + list(APPEND CURL_LIBS ZLIB::ZLIB) + else() + list(APPEND CURL_LIBS cmzlib) + endif() else() list(APPEND CURL_LIBS ${ZLIB_LIBRARIES}) include_directories(${ZLIB_INCLUDE_DIRS}) + list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) endif() - list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) endif() option(CURL_BROTLI "Set to ON to enable building curl with brotli support." OFF) |