From: Viktor Szakats Date: Fri, 13 Sep 2024 03:24:25 +0000 (+0200) Subject: cmake: drop redundant zlib var, rename function (internals) X-Git-Tag: curl-8_11_0~426 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abf737b3ce590d66c3dbe0e2e8edb7326d87f787;p=thirdparty%2Fcurl.git cmake: drop redundant zlib var, rename function (internals) - drop redundant internal variable `USE_ZLIB`, rely on `HAVE_LIBZ`. - rename `optional_dependency()` -> `curl_dependency_option()` Make `grep 'option('` hit this option. Namespaced. It has a single use with `ZLIB`. Closes #14918 --- diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake index d268667ff7..4420bece09 100644 --- a/CMake/Macros.cmake +++ b/CMake/Macros.cmake @@ -64,7 +64,7 @@ macro(curl_internal_test _curl_test) endif() endmacro() -macro(optional_dependency _dependency) +macro(curl_dependency_option _dependency) set(CURL_${_dependency} "AUTO" CACHE STRING "Build curl with ${_dependency} support (AUTO, ON or OFF)") set_property(CACHE CURL_${_dependency} PROPERTY STRINGS "AUTO" "ON" "OFF") diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in index 7dc1f99f02..773dad32ca 100644 --- a/CMake/curl-config.cmake.in +++ b/CMake/curl-config.cmake.in @@ -35,7 +35,7 @@ include(CMakeFindDependencyMacro) if(@USE_OPENSSL@) find_dependency(OpenSSL @OPENSSL_VERSION_MAJOR@) endif() -if(@USE_ZLIB@) +if(@HAVE_LIBZ@) find_dependency(ZLIB @ZLIB_VERSION_MAJOR@) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index aee20fe438..853554f9a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -703,11 +703,9 @@ endif() # and before calling openssl_check_symbol_exists(). set(HAVE_LIBZ OFF) -set(USE_ZLIB OFF) -optional_dependency(ZLIB) +curl_dependency_option(ZLIB) if(ZLIB_FOUND) set(HAVE_LIBZ ON) - set(USE_ZLIB ON) # Depend on ZLIB via imported targets. This allows our dependents to # get our dependencies transitively. @@ -2144,7 +2142,7 @@ if(NOT CURL_DISABLE_INSTALL) # LIB_SELECTED # TARGETS_EXPORT_NAME # USE_OPENSSL - # USE_ZLIB + # HAVE_LIBZ configure_package_config_file("CMake/curl-config.cmake.in" "${_project_config}" INSTALL_DESTINATION ${CURL_INSTALL_CMAKE_DIR}