curl/tests
Viktor Szakats 8fce3e17e6
cmake: add CMake Config-based dependency detection
After limiting `find_package()`/`find_dependency()` calls to curl local
Find modules via the `MODULES` keyword, it became possible to detect
dependencies via CMake Configs from within those local Find modules, by
calling `find_package()` again with the `CONFIG` keyword. This patch
implements this. Then maps detection results to the result variables and
curl-specific imported targets the rest of the build expects.

Also honor recently introduced `*_USE_STATIC_LIBS` (experimental) flags
to map to the static target when requested.

This adds CMake Configs as an alternative to the existing `pkg-config`
and `find_path()`/`find_library()` auto-detection methods.

Enabled by default for MSVC, outside vcpkg and when not cross-building.
To enable for other cases, or override the default, you can use
`-DCURL_USE_CMAKECONFIG=ON` or `OFF`.

When enabled, Config detection happens after `pkg-config` and before
`find_path()`/`find_library()`. Using CMake's built-in options, you may
also manually point to the absolute directory holding Config files:

`Libssh2_DIR`, `MbedTLS_DIR`, `NGHTTP2_DIR`, `NGHTTP3_DIR`,
`NGTCP2_DIR` v1.19.0+ (with non-fork OpenSSL only), `Zstd_DIR` v1.4.5+

E.g. `-DMbedTLS_DIR=/path/to/mbedtls/lib/cmake/MbedTLS`

These dependencies typically need to be built with CMake to support
this.

Tagged as experimental.

Refs:
#20013 #19156 #19117
https://github.com/curl/curl/pull/20784#issuecomment-3984318492

Depends-on: fad1ebaecc #20840
Follow-up to 91e06fde1b #20784
Follow-up to 26c39d8df1 #20015

Closes #20814
2026-03-21 18:52:31 +01:00
..
certs scripts: harden / tidy up more Perl system() calls 2026-03-19 14:26:56 +01:00
cmake cmake: add CMake Config-based dependency detection 2026-03-21 18:52:31 +01:00
data rtmp: drop support 2026-03-21 14:56:06 +01:00
http hostip: fix !no_signal mixup in resolve refaactor 2026-03-21 14:28:54 +01:00
libtest share: concurrency handling, easy updates 2026-03-21 14:42:49 +01:00
server sws: fix potential OOB write 2026-03-19 12:02:10 +01:00
tunit lib: move all UNITTEST prototypes to C files 2026-03-20 07:47:57 +01:00
unit rtmp: drop support 2026-03-21 14:56:06 +01:00
.gitignore tidy-up: .gitignore lines mostly 2025-01-27 20:59:46 +01:00
allversions.pm badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
appveyor.pm tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
azure.pm runtests: fix quoting in Appveyor and Azure test integration 2023-04-22 11:50:03 -07:00
CMakeLists.txt cmake: add CURL_GCC_ANALYZER option, enable in CI, fix/silence 2026-03-16 11:49:34 +01:00
config.in copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
configurehelp.pm.in build: use configurehelp.pm.in with autotools and cmake 2024-09-21 12:21:14 +02:00
devtest.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
dictserver.py badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
directories.pm tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
ech_combos.py tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
ech_tests.sh badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
ftpserver.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
getpart.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
globalconfig.pm runtests: improve XML prolog check, enable -w permanently, fix two tests 2025-12-14 12:26:38 +01:00
http-server.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
http2-server.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
http3-server.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
Makefile.am tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
memanalyze.pl runtests: make memanalyzer a Perl module (for 1.1-2x speed-up per test run) 2025-12-04 13:14:32 +01:00
memanalyzer.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
negtelnetserver.py tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
nghttpx.conf copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
pathhelp.pm tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
processhelp.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
requirements.txt GHA: bump the pip-dependencies group across 2 directories with 3 updates 2025-11-02 17:10:39 +01:00
rtspserver.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
runner.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
runtests.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
secureserver.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
serverhelp.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
servers.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
smbserver.py tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
sshhelp.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
sshserver.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test745.pl tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
test971.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1119.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1135.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1139.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1140.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1165.pl build: disable typecheck via the command-line instead of curl_config.h 2026-02-20 16:32:37 +01:00
test1167.pl tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
test1173.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1175.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1177.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1222.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1275.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1276.pl optiontable: replace stdin with filename arg, harden open() call 2026-03-19 15:06:43 +01:00
test1477.pl tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
test1486.pl src: fix formatting nits 2025-12-03 20:50:18 +01:00
test1488.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1544.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
test1707.pl scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
testcurl.pl scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
testutil.pm tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
tftpserver.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
util.py tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
valgrind.pm scripts: drop redundant double-quotes: "$var" -> $var (Perl) 2026-03-21 13:21:06 +01:00
valgrind.supp hyper: drop support 2024-12-21 11:33:05 +01:00