From: Viktor Szakats Date: Thu, 6 Feb 2025 01:50:09 +0000 (+0100) Subject: cmake: always reference OpenSSL and ZLIB via imported targets X-Git-Tag: curl-8_12_1~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8c5be1884333f6c28486c87b6054cd067dbf72d0;p=thirdparty%2Fcurl.git cmake: always reference OpenSSL and ZLIB via imported targets Some places where still referencing them via global variables. Closes #16207 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bf2d4381c..5f7feecfec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -744,7 +744,7 @@ if(CURL_USE_OPENSSL) set(_curl_ca_bundle_supported TRUE) cmake_push_check_state() - list(APPEND CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) if(NOT DEFINED HAVE_BORINGSSL) check_symbol_exists("OPENSSL_IS_BORINGSSL" "openssl/base.h" HAVE_BORINGSSL) endif() @@ -941,10 +941,9 @@ endif() macro(curl_openssl_check_symbol_exists _symbol _files _variable) cmake_push_check_state() if(USE_OPENSSL) - list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") - list(APPEND CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}") + list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) if(HAVE_LIBZ) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}") + list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB) endif() if(WIN32) list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32") @@ -956,8 +955,7 @@ macro(curl_openssl_check_symbol_exists _symbol _files _variable) list(APPEND CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}") curl_required_libpaths("${WOLFSSL_LIBRARY_DIRS}") if(HAVE_LIBZ) - list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") # Public wolfSSL headers require zlib headers - list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}") + list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB) # Public wolfSSL headers also require zlib headers endif() if(WIN32) list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32" "crypt32") @@ -1182,7 +1180,7 @@ if(NOT CURL_DISABLE_LDAP) # Check for LDAP cmake_push_check_state() if(USE_OPENSSL) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) endif() find_package(LDAP) if(LDAP_FOUND)