FindCURL: use COMPONENTS to verify library features avaiable
libcurl library is single monolithic binary with multiple optional protocols and features. Some of binary packages are build with all features enabled but it's unknown for CMake user. Simple find_package(CURL)
could be not enough to be sure correct libcurl is available and delivers expected features.
Using #18378 approach should enable protocols and additional features listed in libbcurl.pc
to be analysed and verified at CMake configuration time.
find_package(CURL COMPONENTS HTTP HTTPS LDAP LDAPS NTLM OPTIONAL_COMPONENTS IPv6 HTTPS-proxy)
syntax should be supported - user should be warned if some listed features are missing and error raised if they are required.
Example of libcurl.pc
file from Debian:
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=/usr/include/x86_64-linux-gnu
supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP"
supported_features="SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy"
Name: libcurl
URL: https://curl.haxx.se/
Description: Library to transfer files with ftp, http, etc.
Version: 7.52.1
Libs: -L${libdir} -lcurl
Libs.private: -lnghttp2 -lidn2 -lrtmp -lssh2 -lpsl -lssl -lcrypto -lssl -lcrypto -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -llber -llber -lldap -lz
Cflags: -I${includedir}