mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
CMake: Set at most one SSL library
Ref: https://github.com/curl/curl/pull/1228
This commit is contained in:
parent
c6a97466b9
commit
813263dc3a
@ -29,3 +29,16 @@ function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL)
|
|||||||
set(${RETVAL} TRUE PARENT_SCOPE)
|
set(${RETVAL} TRUE PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Returns a list of arguments that evaluate to true
|
||||||
|
function(collect_true output_var output_count_var)
|
||||||
|
set(${output_var})
|
||||||
|
foreach(option_var IN LISTS ARGN)
|
||||||
|
if(${option_var})
|
||||||
|
list(APPEND ${output_var} ${option_var})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(${output_var} ${${output_var}} PARENT_SCOPE)
|
||||||
|
list(LENGTH ${output_var} ${output_count_var})
|
||||||
|
set(${output_count_var} ${${output_count_var}} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
@ -308,12 +308,22 @@ endif()
|
|||||||
option(CMAKE_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF)
|
option(CMAKE_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF)
|
||||||
|
|
||||||
set(openssl_default ON)
|
set(openssl_default ON)
|
||||||
if(WIN32)
|
if(WIN32 OR CMAKE_USE_DARWINSSL OR CMAKE_USE_WINSSL OR CMAKE_USE_MBEDTLS)
|
||||||
set(openssl_default OFF)
|
set(openssl_default OFF)
|
||||||
endif()
|
endif()
|
||||||
option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ${openssl_default})
|
option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ${openssl_default})
|
||||||
|
|
||||||
if(CMAKE_USE_WINSSL AND NOT SSL_ENABLED)
|
collect_true(enabled_ssl_options enabled_ssl_options_count
|
||||||
|
CMAKE_USE_WINSSL
|
||||||
|
CMAKE_USE_DARWINSSL
|
||||||
|
CMAKE_USE_OPENSSL
|
||||||
|
CMAKE_USE_MBEDTLS
|
||||||
|
)
|
||||||
|
if(enabled_ssl_options_count GREATER 1)
|
||||||
|
message(FATAL_ERROR "Multiple SSL options specified: ${enabled_ssl_options}. Please pick at most one and disable the rest.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_USE_WINSSL)
|
||||||
set(SSL_ENABLED ON)
|
set(SSL_ENABLED ON)
|
||||||
set(USE_SCHANNEL ON) # Windows native SSL/TLS support
|
set(USE_SCHANNEL ON) # Windows native SSL/TLS support
|
||||||
set(USE_WINDOWS_SSPI ON) # CMAKE_USE_WINSSL implies CURL_WINDOWS_SSPI
|
set(USE_WINDOWS_SSPI ON) # CMAKE_USE_WINSSL implies CURL_WINDOWS_SSPI
|
||||||
@ -324,7 +334,7 @@ if(CURL_WINDOWS_SSPI)
|
|||||||
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DSECURITY_WIN32")
|
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DSECURITY_WIN32")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_USE_DARWINSSL AND NOT SSL_ENABLED)
|
if(CMAKE_USE_DARWINSSL)
|
||||||
find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
|
find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
|
||||||
if(NOT COREFOUNDATION_FRAMEWORK)
|
if(NOT COREFOUNDATION_FRAMEWORK)
|
||||||
message(FATAL_ERROR "CoreFoundation framework not found")
|
message(FATAL_ERROR "CoreFoundation framework not found")
|
||||||
@ -340,7 +350,7 @@ if(CMAKE_USE_DARWINSSL AND NOT SSL_ENABLED)
|
|||||||
list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}")
|
list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_USE_OPENSSL AND NOT SSL_ENABLED)
|
if(CMAKE_USE_OPENSSL)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
set(SSL_ENABLED ON)
|
set(SSL_ENABLED ON)
|
||||||
set(USE_OPENSSL ON)
|
set(USE_OPENSSL ON)
|
||||||
@ -363,7 +373,7 @@ if(CMAKE_USE_OPENSSL AND NOT SSL_ENABLED)
|
|||||||
check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD)
|
check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_USE_MBEDTLS AND NOT SSL_ENABLED)
|
if(CMAKE_USE_MBEDTLS)
|
||||||
find_package(MbedTLS REQUIRED)
|
find_package(MbedTLS REQUIRED)
|
||||||
set(SSL_ENABLED ON)
|
set(SSL_ENABLED ON)
|
||||||
set(USE_MBEDTLS ON)
|
set(USE_MBEDTLS ON)
|
||||||
|
@ -24,7 +24,8 @@ Current flaws in the curl CMake build
|
|||||||
Missing features in the cmake build:
|
Missing features in the cmake build:
|
||||||
|
|
||||||
- Builds libcurl without large file support
|
- Builds libcurl without large file support
|
||||||
- Can't select which SSL library to build with, only OpenSSL
|
- Does not support all SSL libraries (only OpenSSL, WinSSL, DarwinSSL, and
|
||||||
|
mbed TLS)
|
||||||
- Doesn't build with SCP and SFTP support (libssh2)
|
- Doesn't build with SCP and SFTP support (libssh2)
|
||||||
- Doesn't allow different resolver backends (no c-ares build support)
|
- Doesn't allow different resolver backends (no c-ares build support)
|
||||||
- No RTMP support built
|
- No RTMP support built
|
||||||
|
Loading…
Reference in New Issue
Block a user