diff options
author | Brad King <brad.king@kitware.com> | 2022-01-07 11:41:57 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-01-07 11:41:57 -0500 |
commit | 697e8871a1d1cf56f01866c082235ea20bd1057f (patch) | |
tree | b0fe132b726b5dcce50eac5b2de3ac7456df3d18 /Utilities/cmcurl/CMakeLists.txt | |
parent | bdb3a8203e1a1207e7a89dca1b3e6a569a732b10 (diff) | |
parent | a1f6ec647cfab8d613897562f8ee5f81a8f6b68d (diff) | |
download | cmake-697e8871a1d1cf56f01866c082235ea20bd1057f.tar.gz |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2022-01-05 (801bd513)
Diffstat (limited to 'Utilities/cmcurl/CMakeLists.txt')
-rw-r--r-- | Utilities/cmcurl/CMakeLists.txt | 152 |
1 files changed, 86 insertions, 66 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index cd5d3542a5..cd5e0a8681 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -387,6 +387,17 @@ if(ENABLE_IPV6 AND NOT WIN32) set(ENABLE_IPV6 OFF CACHE BOOL "Define if you want to enable IPv6 support" FORCE) endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_ARES) + set(use_core_foundation ON) + + find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration") + if(NOT SYSTEMCONFIGURATION_FRAMEWORK) + message(FATAL_ERROR "SystemConfiguration framework not found") + endif() + + list(APPEND CURL_LIBS "-framework SystemConfiguration") + endif() endif() if(0) # This code not needed for building within CMake. @@ -479,84 +490,94 @@ if(WIN32) check_library_exists_concat("winmm" getch HAVE_LIBWINMM) endif() -# check SSL libraries -# TODO support GnuTLS +# This check below for use of deprecated symbols is only temporary and is to +# be removed again after a year's service. Remove after November 25, 2022. +set(CURL_RECONFIG_REQUIRED 0) +foreach(_LIB GSSAPI OPENLDAP LIBSSH LIBSSH2 BEARSSL MBEDTLS NSS OPENSSL + SCHANNEL SECTRANSP WOLFSSL) + if(CMAKE_USE_${_LIB}) + set(CURL_RECONFIG_REQUIRED 1) + message(SEND_ERROR "The option CMAKE_USE_${_LIB} was renamed to CURL_USE_${_LIB}.") + endif() +endforeach() if(CMAKE_USE_WINSSL) - message(FATAL_ERROR "The cmake option CMAKE_USE_WINSSL was renamed to CMAKE_USE_SCHANNEL.") + set(CURL_RECONFIG_REQUIRED 1) + message(SEND_ERROR "The option CMAKE_USE_WINSSL was renamed to CURL_USE_SCHANNEL.") +endif() +if(CURL_RECONFIG_REQUIRED) + message(FATAL_ERROR "Reconfig required") endif() +# check SSL libraries +# TODO support GnuTLS +option(CURL_ENABLE_SSL "Enable SSL support" ON) + if(APPLE) - option(CMAKE_USE_SECTRANSP "enable Apple OS native SSL/TLS" OFF) + cmake_dependent_option(CURL_USE_SECTRANSP "enable Apple OS native SSL/TLS" OFF CURL_ENABLE_SSL OFF) endif() if(WIN32) - option(CMAKE_USE_SCHANNEL "enable Windows native SSL/TLS" OFF) + cmake_dependent_option(CURL_USE_SCHANNEL "enable Windows native SSL/TLS" OFF CURL_ENABLE_SSL OFF) cmake_dependent_option(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON - CMAKE_USE_SCHANNEL OFF) + CURL_USE_SCHANNEL OFF) endif() -option(CMAKE_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF) -option(CMAKE_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF) -option(CMAKE_USE_NSS "Enable NSS for SSL/TLS" OFF) -option(CMAKE_USE_WOLFSSL "enable wolfSSL for SSL/TLS" OFF) +cmake_dependent_option(CURL_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF) +cmake_dependent_option(CURL_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF) +cmake_dependent_option(CURL_USE_NSS "Enable NSS for SSL/TLS" OFF CURL_ENABLE_SSL OFF) +cmake_dependent_option(CURL_USE_WOLFSSL "enable wolfSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF) set(openssl_default ON) -if(WIN32 OR CMAKE_USE_SECTRANSP OR CMAKE_USE_SCHANNEL OR CMAKE_USE_MBEDTLS OR CMAKE_USE_NSS OR CMAKE_USE_WOLFSSL) +if(WIN32 OR CURL_USE_SECTRANSP OR CURL_USE_SCHANNEL OR CURL_USE_MBEDTLS OR CURL_USE_NSS OR CURL_USE_WOLFSSL) set(openssl_default OFF) endif() +cmake_dependent_option(CURL_USE_OPENSSL "Use OpenSSL code. Experimental" ${openssl_default} CURL_ENABLE_SSL OFF) option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF) count_true(enabled_ssl_options_count - CMAKE_USE_SCHANNEL - CMAKE_USE_SECTRANSP - CMAKE_USE_OPENSSL - CMAKE_USE_MBEDTLS - CMAKE_USE_BEARSSL - CMAKE_USE_NSS - CMAKE_USE_WOLFSSL + CURL_USE_SCHANNEL + CURL_USE_SECTRANSP + CURL_USE_OPENSSL + CURL_USE_MBEDTLS + CURL_USE_BEARSSL + CURL_USE_NSS + CURL_USE_WOLFSSL ) if(enabled_ssl_options_count GREATER "1") set(CURL_WITH_MULTI_SSL ON) endif() -if(CMAKE_USE_SCHANNEL) +if(CURL_USE_SCHANNEL) set(SSL_ENABLED ON) set(USE_SCHANNEL ON) # Windows native SSL/TLS support - set(USE_WINDOWS_SSPI ON) # CMAKE_USE_SCHANNEL implies CURL_WINDOWS_SSPI + set(USE_WINDOWS_SSPI ON) # CURL_USE_SCHANNEL implies CURL_WINDOWS_SSPI endif() if(CURL_WINDOWS_SSPI) set(USE_WINDOWS_SSPI ON) set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DSECURITY_WIN32") endif() -if(CMAKE_USE_DARWINSSL) - message(FATAL_ERROR "The cmake option CMAKE_USE_DARWINSSL was renamed to CMAKE_USE_SECTRANSP.") +if(CURL_USE_SECTRANSP) + set(use_core_foundation ON) + + find_library(SECURITY_FRAMEWORK "Security") + if(NOT SECURITY_FRAMEWORK) + message(FATAL_ERROR "Security framework not found") + endif() + + set(SSL_ENABLED ON) + set(USE_SECTRANSP ON) + list(APPEND CURL_LIBS "-framework Security") endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +if(use_core_foundation) find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation") if(NOT COREFOUNDATION_FRAMEWORK) message(FATAL_ERROR "CoreFoundation framework not found") endif() - find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration") - if(NOT SYSTEMCONFIGURATION_FRAMEWORK) - message(FATAL_ERROR "SystemConfiguration framework not found") - endif() - - list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework SystemConfiguration") - - if(CMAKE_USE_SECTRANSP) - find_library(SECURITY_FRAMEWORK "Security") - if(NOT SECURITY_FRAMEWORK) - message(FATAL_ERROR "Security framework not found") - endif() - - set(SSL_ENABLED ON) - set(USE_SECTRANSP ON) - list(APPEND CURL_LIBS "-framework Security") - endif() + list(APPEND CURL_LIBS "-framework CoreFoundation") endif() -if(CMAKE_USE_OPENSSL) +if(CURL_USE_OPENSSL) find_package(OpenSSL) if(NOT OpenSSL_FOUND) message(FATAL_ERROR @@ -588,9 +609,11 @@ if(CMAKE_USE_OPENSSL) if(CURL_CA_PATH) add_definitions(-DCURL_CA_PATH="${CURL_CA_PATH}") endif() + + add_definitions(-DOPENSSL_SUPPRESS_DEPRECATED) endif() -if(CMAKE_USE_MBEDTLS) +if(CURL_USE_MBEDTLS) find_package(MbedTLS REQUIRED) set(SSL_ENABLED ON) set(USE_MBEDTLS ON) @@ -598,7 +621,7 @@ if(CMAKE_USE_MBEDTLS) include_directories(${MBEDTLS_INCLUDE_DIRS}) endif() -if(CMAKE_USE_BEARSSL) +if(CURL_USE_BEARSSL) find_package(BearSSL REQUIRED) set(SSL_ENABLED ON) set(USE_BEARSSL ON) @@ -606,7 +629,7 @@ if(CMAKE_USE_BEARSSL) include_directories(${BEARSSL_INCLUDE_DIRS}) endif() -if(CMAKE_USE_WOLFSSL) +if(CURL_USE_WOLFSSL) find_package(WolfSSL REQUIRED) set(SSL_ENABLED ON) set(USE_WOLFSSL ON) @@ -614,7 +637,7 @@ if(CMAKE_USE_WOLFSSL) include_directories(${WolfSSL_INCLUDE_DIRS}) endif() -if(CMAKE_USE_NSS) +if(CURL_USE_NSS) find_package(NSS REQUIRED) include_directories(${NSS_INCLUDE_DIRS}) list(APPEND CURL_LIBS ${NSS_LIBRARIES}) @@ -695,13 +718,13 @@ if(NOT CURL_DISABLE_LDAP) endif() endif() - option(CMAKE_USE_OPENLDAP "Use OpenLDAP code." OFF) - mark_as_advanced(CMAKE_USE_OPENLDAP) + option(CURL_USE_OPENLDAP "Use OpenLDAP code." OFF) + mark_as_advanced(CURL_USE_OPENLDAP) set(CMAKE_LDAP_LIB "ldap" CACHE STRING "Name or full path to ldap library") set(CMAKE_LBER_LIB "lber" CACHE STRING "Name or full path to lber library") - if(CMAKE_USE_OPENLDAP AND USE_WIN32_LDAP) - message(FATAL_ERROR "Cannot use USE_WIN32_LDAP and CMAKE_USE_OPENLDAP at the same time") + if(CURL_USE_OPENLDAP AND USE_WIN32_LDAP) + message(FATAL_ERROR "Cannot use USE_WIN32_LDAP and CURL_USE_OPENLDAP at the same time") endif() # Now that we know, we're not using windows LDAP... @@ -731,7 +754,7 @@ if(NOT CURL_DISABLE_LDAP) set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used else() - if(CMAKE_USE_OPENLDAP) + if(CURL_USE_OPENLDAP) set(USE_OPENLDAP ON) endif() if(CMAKE_LDAP_INCLUDE_DIR) @@ -873,13 +896,13 @@ if(CURL_ZSTD) endif() #libSSH2 -option(CMAKE_USE_LIBSSH2 "Use libSSH2" ON) -mark_as_advanced(CMAKE_USE_LIBSSH2) +option(CURL_USE_LIBSSH2 "Use libSSH2" ON) +mark_as_advanced(CURL_USE_LIBSSH2) set(USE_LIBSSH2 OFF) set(HAVE_LIBSSH2 OFF) set(HAVE_LIBSSH2_H OFF) -if(CMAKE_USE_LIBSSH2) +if(CURL_USE_LIBSSH2) find_package(LibSSH2) if(LIBSSH2_FOUND) list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY}) @@ -898,9 +921,9 @@ if(CMAKE_USE_LIBSSH2) endif() # libssh -option(CMAKE_USE_LIBSSH "Use libSSH" OFF) -mark_as_advanced(CMAKE_USE_LIBSSH) -if(NOT HAVE_LIBSSH2 AND CMAKE_USE_LIBSSH) +option(CURL_USE_LIBSSH "Use libSSH" OFF) +mark_as_advanced(CURL_USE_LIBSSH) +if(NOT HAVE_LIBSSH2 AND CURL_USE_LIBSSH) find_package(libssh CONFIG) if(libssh_FOUND) message(STATUS "Found libssh ${libssh_VERSION}") @@ -911,10 +934,10 @@ if(NOT HAVE_LIBSSH2 AND CMAKE_USE_LIBSSH) endif() endif() -option(CMAKE_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is supported with CMake build)" OFF) -mark_as_advanced(CMAKE_USE_GSSAPI) +option(CURL_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is supported with CMake build)" OFF) +mark_as_advanced(CURL_USE_GSSAPI) -if(CMAKE_USE_GSSAPI) +if(CURL_USE_GSSAPI) find_package(GSS) set(HAVE_GSSAPI ${GSS_FOUND}) @@ -1065,7 +1088,6 @@ endif() # Check for header files if(NOT UNIX) check_include_file_concat("windows.h" HAVE_WINDOWS_H) - check_include_file_concat("winsock.h" HAVE_WINSOCK_H) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) check_include_file_concat("wincrypt.h" HAVE_WINCRYPT_H) @@ -1643,12 +1665,10 @@ set(libdir "${CMAKE_INSTALL_PREFIX}/lib") foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS}) if(TARGET "${_lib}") set(_libname "${_lib}") - get_target_property(_libtype "${_libname}" TYPE) - if(_libtype STREQUAL INTERFACE_LIBRARY) - # Interface libraries can occur when an external project embeds curl and - # defined targets such as ZLIB::ZLIB by themselves. Ignore these as - # reading the LOCATION property will error out. Assume the user won't need - # this information in the .pc file. + get_target_property(_imported "${_libname}" IMPORTED) + if(NOT _imported) + # Reading the LOCATION property on non-imported target will error out. + # Assume the user won't need this information in the .pc file. continue() endif() get_target_property(_lib "${_libname}" LOCATION) |