From eca41c0243003a25d426183aaff90457d2ddb7a3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Mar 2023 16:41:57 -0400 Subject: curl: Restore build within CMake after update to 8.0.1 Restore changes from commit 2be5a7de4e (Build: Use imported target `ZLIB::ZLIB` instead of variables, 2022-08-21, v3.25.0-rc1~97^2~10) that were undone by the update to curl 8.0.1. The code was moved. --- Utilities/cmcurl/CMakeLists.txt | 10 +++++++--- 1 file 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) -- cgit v1.2.1