mirror of
https://github.com/Kitware/CMake.git
synced 2025-05-08 22:37:04 +08:00
FindCURL: Fix hardcoded outdated protocols and features
This removes the hardcoded known protocols and features and only checks whether the specified component(s) by the `find_package(COMPONENT|OPTIONAL_COMPONENT <components>...)` call are found and listed by either the pkg-config or the curl-config tool. When curl is found via its CMake package configuration file, this issue wasn't relevant. Additionally, this also removes two internal FindCURL module variables `CURL_KNOWN_PROTOCOLS` and `CURL_KNOWN_FEATURES`. Redundant fatal error thrown is also removed as this is handled by the `find_package_handle_standard_args()`. Fixes #26866
This commit is contained in:
parent
ca9fa874d8
commit
4acfe363a2
@ -27,10 +27,13 @@ Components
|
||||
This module supports optional components to detect the protocols and features
|
||||
available in the installed curl (these can vary based on the curl version)::
|
||||
|
||||
Protocols: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3
|
||||
POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP
|
||||
Features: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO
|
||||
Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy
|
||||
Protocols: DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS IPFS IPNS
|
||||
LDAP LDAPS MQTT POP3 POP3S RTMP RTMPS RTSP SCP SFTP SMB SMBS SMTP
|
||||
SMTPS TELNET TFTP WS WSS
|
||||
Features: alt-svc asyn-rr AsynchDNS brotli CAcert Debug ECH gsasl GSS-API
|
||||
HSTS HTTP2 HTTP3 HTTPS-proxy HTTPSRR IDN IPv6 Kerberos Largefile
|
||||
libz MultiSSL NTLM NTLM_WB PSL SPNEGO SSL SSLS-EXPORT SSPI
|
||||
threadsafe TLS-SRP TrackMemory Unicode UnixSockets zstd
|
||||
|
||||
Components can be specified with the :command:`find_package` command as required
|
||||
for curl to be considered found:
|
||||
@ -240,11 +243,10 @@ if(CURL_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if(CURL_FIND_COMPONENTS)
|
||||
set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP)
|
||||
set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy)
|
||||
foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES)
|
||||
foreach(component IN LISTS CURL_FIND_COMPONENTS)
|
||||
set(CURL_${component}_FOUND FALSE)
|
||||
endforeach()
|
||||
|
||||
if(NOT PC_CURL_FOUND)
|
||||
find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config)
|
||||
if(CURL_CONFIG_EXECUTABLE)
|
||||
@ -263,23 +265,17 @@ if(CURL_FIND_COMPONENTS)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
foreach(component IN LISTS CURL_FIND_COMPONENTS)
|
||||
list(FIND CURL_KNOWN_PROTOCOLS ${component} _found)
|
||||
list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found)
|
||||
|
||||
if(NOT _found EQUAL -1)
|
||||
list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found)
|
||||
if(NOT _found EQUAL -1)
|
||||
set(CURL_${component}_FOUND TRUE)
|
||||
elseif(CURL_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "CURL: Required protocol ${component} is not found")
|
||||
endif()
|
||||
set(CURL_${component}_FOUND TRUE)
|
||||
else()
|
||||
list(FIND CURL_SUPPORTED_FEATURES ${component} _found)
|
||||
if(NOT _found EQUAL -1)
|
||||
set(CURL_${component}_FOUND TRUE)
|
||||
elseif(CURL_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "CURL: Required feature ${component} is not found")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
Loading…
x
Reference in New Issue
Block a user