mirror of
https://github.com/curl/curl.git
synced 2025-09-10 22:22:43 +03:00
cmake: make system libraries dl
, m
, pthread
customizable
via `DL_LIBRARY`, `MATH_LIBRARY`, `PTHREAD_LIBRARY` variables. They are used in Rustls, wolfSSL Find modules. Also: - always use `NAMES` keyword in `find_library()` calls. - respect `find_library()` results for `dl`, `m`, `pthread`. - formatting. Closes #15892
This commit is contained in:
parent
9a9498ea1e
commit
27b9e76706
|
@ -72,35 +72,35 @@ else()
|
|||
endif()
|
||||
|
||||
if(APPLE)
|
||||
find_library(SECURITY_FRAMEWORK "Security")
|
||||
find_library(SECURITY_FRAMEWORK NAMES "Security")
|
||||
mark_as_advanced(SECURITY_FRAMEWORK)
|
||||
if(NOT SECURITY_FRAMEWORK)
|
||||
message(FATAL_ERROR "Security framework not found")
|
||||
endif()
|
||||
list(APPEND RUSTLS_LIBRARIES "-framework Security")
|
||||
|
||||
find_library(FOUNDATION_FRAMEWORK "Foundation")
|
||||
find_library(FOUNDATION_FRAMEWORK NAMES "Foundation")
|
||||
mark_as_advanced(FOUNDATION_FRAMEWORK)
|
||||
if(NOT FOUNDATION_FRAMEWORK)
|
||||
message(FATAL_ERROR "Foundation framework not found")
|
||||
endif()
|
||||
list(APPEND RUSTLS_LIBRARIES "-framework Foundation")
|
||||
elseif(NOT WIN32)
|
||||
find_library(_pthread_library "pthread")
|
||||
if(_pthread_library)
|
||||
list(APPEND RUSTLS_LIBRARIES "pthread")
|
||||
find_library(PTHREAD_LIBRARY NAMES "pthread")
|
||||
if(PTHREAD_LIBRARY)
|
||||
list(APPEND RUSTLS_LIBRARIES ${PTHREAD_LIBRARY})
|
||||
endif()
|
||||
mark_as_advanced(_pthread_library)
|
||||
mark_as_advanced(PTHREAD_LIBRARY)
|
||||
|
||||
find_library(_dl_library "dl")
|
||||
if(_dl_library)
|
||||
list(APPEND RUSTLS_LIBRARIES "dl")
|
||||
find_library(DL_LIBRARY NAMES "dl")
|
||||
if(DL_LIBRARY)
|
||||
list(APPEND RUSTLS_LIBRARIES ${DL_LIBRARY})
|
||||
endif()
|
||||
mark_as_advanced(_dl_library)
|
||||
mark_as_advanced(DL_LIBRARY)
|
||||
|
||||
find_library(_math_library "m")
|
||||
if(_math_library)
|
||||
list(APPEND RUSTLS_LIBRARIES "m")
|
||||
find_library(MATH_LIBRARY NAMES "m")
|
||||
if(MATH_LIBRARY)
|
||||
list(APPEND RUSTLS_LIBRARIES ${MATH_LIBRARY})
|
||||
endif()
|
||||
mark_as_advanced(_math_library)
|
||||
mark_as_advanced(MATH_LIBRARY)
|
||||
endif()
|
||||
|
|
|
@ -91,9 +91,9 @@ else()
|
|||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
find_library(_math_library "m")
|
||||
if(_math_library)
|
||||
list(APPEND WOLFSSL_LIBRARIES "m") # for log and pow
|
||||
find_library(MATH_LIBRARY NAMES "m")
|
||||
if(MATH_LIBRARY)
|
||||
list(APPEND WOLFSSL_LIBRARIES ${MATH_LIBRARY}) # for log and pow
|
||||
endif()
|
||||
mark_as_advanced(_math_library)
|
||||
mark_as_advanced(MATH_LIBRARY)
|
||||
endif()
|
||||
|
|
|
@ -469,12 +469,11 @@ if(ENABLE_IPV6 AND NOT WIN32)
|
|||
if(APPLE AND NOT ENABLE_ARES)
|
||||
set(_use_core_foundation_and_core_services ON)
|
||||
|
||||
find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")
|
||||
find_library(SYSTEMCONFIGURATION_FRAMEWORK NAMES "SystemConfiguration")
|
||||
mark_as_advanced(SYSTEMCONFIGURATION_FRAMEWORK)
|
||||
if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
|
||||
message(FATAL_ERROR "SystemConfiguration framework not found")
|
||||
endif()
|
||||
|
||||
list(APPEND CURL_LIBS "-framework SystemConfiguration")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -656,15 +655,15 @@ endif()
|
|||
if(CURL_USE_SECTRANSP)
|
||||
set(_use_core_foundation_and_core_services ON)
|
||||
|
||||
find_library(SECURITY_FRAMEWORK "Security")
|
||||
find_library(SECURITY_FRAMEWORK NAMES "Security")
|
||||
mark_as_advanced(SECURITY_FRAMEWORK)
|
||||
if(NOT SECURITY_FRAMEWORK)
|
||||
message(FATAL_ERROR "Security framework not found")
|
||||
endif()
|
||||
list(APPEND CURL_LIBS "-framework Security")
|
||||
|
||||
set(_ssl_enabled ON)
|
||||
set(USE_SECTRANSP ON)
|
||||
list(APPEND CURL_LIBS "-framework Security")
|
||||
|
||||
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "secure-transport")
|
||||
set(_valid_default_ssl_backend TRUE)
|
||||
|
@ -674,19 +673,19 @@ if(CURL_USE_SECTRANSP)
|
|||
endif()
|
||||
|
||||
if(_use_core_foundation_and_core_services)
|
||||
find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
|
||||
find_library(COREFOUNDATION_FRAMEWORK NAMES "CoreFoundation")
|
||||
mark_as_advanced(COREFOUNDATION_FRAMEWORK)
|
||||
find_library(CORESERVICES_FRAMEWORK "CoreServices")
|
||||
mark_as_advanced(CORESERVICES_FRAMEWORK)
|
||||
|
||||
if(NOT COREFOUNDATION_FRAMEWORK)
|
||||
message(FATAL_ERROR "CoreFoundation framework not found")
|
||||
endif()
|
||||
list(APPEND CURL_LIBS "-framework CoreFoundation")
|
||||
|
||||
find_library(CORESERVICES_FRAMEWORK NAMES "CoreServices")
|
||||
mark_as_advanced(CORESERVICES_FRAMEWORK)
|
||||
if(NOT CORESERVICES_FRAMEWORK)
|
||||
message(FATAL_ERROR "CoreServices framework not found")
|
||||
endif()
|
||||
|
||||
list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework CoreServices")
|
||||
list(APPEND CURL_LIBS "-framework CoreServices")
|
||||
endif()
|
||||
|
||||
if(CURL_USE_OPENSSL)
|
||||
|
|
|
@ -317,6 +317,7 @@ Details via CMake
|
|||
- `BROTLIDEC_LIBRARY`: Path to `brotlidec` library.
|
||||
- `CARES_INCLUDE_DIR`: The c-ares include directory.
|
||||
- `CARES_LIBRARY`: Path to `cares` library.
|
||||
- `DL_LIBRARY`: Path to `dl` library. (for Rustls)
|
||||
- `GSS_ROOT_DIR`: Set this variable to the root installation of GSS. (also supported as environment)
|
||||
- `LDAP_LIBRARY`: Name or full path to `ldap` library. Default: `ldap`
|
||||
- `LDAP_LBER_LIBRARY`: Name or full path to `lber` library. Default: `lber`
|
||||
|
@ -335,12 +336,13 @@ Details via CMake
|
|||
- `LIBSSH2_LIBRARY`: Path to `libssh2` library.
|
||||
- `LIBUV_INCLUDE_DIR`: The libuv include directory.
|
||||
- `LIBUV_LIBRARY`: Path to `libuv` library.
|
||||
- `MSH3_INCLUDE_DIR`: The msh3 include directory.
|
||||
- `MSH3_LIBRARY`: Path to `msh3` library.
|
||||
- `MATH_LIBRARY`: Path to `m` library. (for Rustls, wolfSSL)
|
||||
- `MBEDTLS_INCLUDE_DIR`: The mbedTLS include directory.
|
||||
- `MBEDTLS_LIBRARY`: Path to `mbedtls` library.
|
||||
- `MBEDX509_LIBRARY`: Path to `mbedx509` library.
|
||||
- `MBEDCRYPTO_LIBRARY`: Path to `mbedcrypto` library.
|
||||
- `MSH3_INCLUDE_DIR`: The msh3 include directory.
|
||||
- `MSH3_LIBRARY`: Path to `msh3` library.
|
||||
- `NGHTTP2_INCLUDE_DIR`: The nghttp2 include directory.
|
||||
- `NGHTTP2_LIBRARY`: Path to `nghttp2` library.
|
||||
- `NGHTTP3_INCLUDE_DIR`: The nghttp3 include directory.
|
||||
|
@ -349,6 +351,7 @@ Details via CMake
|
|||
- `NGTCP2_LIBRARY`: Path to `ngtcp2` library.
|
||||
- `NETTLE_INCLUDE_DIR`: The nettle include directory.
|
||||
- `NETTLE_LIBRARY`: Path to `nettle` library.
|
||||
- `PTHREAD_LIBRARY`: Path to `pthread` library. (for Rustls)
|
||||
- `QUICHE_INCLUDE_DIR`: The quiche include directory.
|
||||
- `QUICHE_LIBRARY`: Path to `quiche` library.
|
||||
- `RUSTLS_INCLUDE_DIR`: The Rustls include directory.
|
||||
|
|
Loading…
Reference in New Issue
Block a user