diff --git a/CMakeLists.txt b/CMakeLists.txt index ed60f07bcee3..0ae82fe44b55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -429,24 +429,11 @@ endif() # Keep compression lib detection before TLS detection, which # might depend on it. -set(HAVE_LIBZ OFF) -set(USE_ZLIB OFF) -optional_dependency(ZLIB) -if(ZLIB_FOUND) - set(HAVE_LIBZ ON) - set(USE_ZLIB ON) - - # Depend on ZLIB via imported targets if supported by the running - # 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) - else() - list(APPEND CURL_LIBS ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIRS}) - endif() - list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) -endif() +set(HAVE_LIBZ ON) +set(USE_ZLIB ON) +list(APPEND CURL_LIBS ${ZLIB_LIBRARIES}) +include_directories(${ZLIB_INCLUDE_DIRS}) +list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) option(CURL_BROTLI "Set to ON to enable building curl with brotli support." OFF) set(HAVE_BROTLI OFF)