curl-curl/tests
Viktor Szakats 16f073ef49
cmake: define dependencies as IMPORTED interface targets
Rework the way curl's custom Find modules advertise their properties.

Before this patch, Find modules returned detected dependency properties
(header dirs, libs, libdirs, C flags, etc.) via global variables. curl's
main `CMakeLists.txt` copied their values into global lists, which it
later applied to targets. This solution worked internally, but it was
unsuited for the public, distributed `CURLConfig.cmake` and publishing
curl's Find modules with it, due to polluting the namespace of consumer
projects. It's also impractical to apply the many individual variables
to every targets depending on libcurl.

To allow using Find modules in consumer projects, this patch makes them
define as imported interface targets, named `CURL::<dependency>`. Then
store dependency information as target properties. It avoids namespace
pollution and makes the dependency information apply automatically
to all targets using `CURL::libcurl_static`.

Find modules continue to return `*_FOUND` and `*_VERSION` variables.

For dependencies detected via `pkg-config`, CMake 3.16+ is recommended.
Older CMake versions have a varying degree of support for
propagating/handling library directories. This may cause issues in envs
where dependencies reside in non-system locations and detected via
`pkg-config` (e.g. macOS + Homebrew). Use `CURL_USE_PKGCONFIG=OFF`
to fix these issues. Or upgrade to newer CMake, or link libcurl
dynamically.

Also:
- re-enable `pkg-config` for old cmake `find_library()` integration
  tests.
- make `curlinfo` build after these changes.
- distribute local Find modules.
- export the raw list of lib dependencies via `CURL_LIBRARIES_PRIVATE`.
- `CURLconfig.cmake`: use curl's Find modules to detect dependencies in
  the consumer env.
- add custom property to target property debug function.
- the curl build process no longer modifies `CMAKE_C_FLAGS`.
  Follow-up to e86542038d #17047

Ref: #14930
Ref: https://github.com/libssh2/libssh2/pull/1535
Ref: https://github.com/libssh2/libssh2/pull/1571
Ref: https://github.com/libssh2/libssh2/pull/1581
Ref: https://github.com/libssh2/libssh2/pull/1623

Closes #16973
2025-11-29 01:41:40 +01:00
..
certs badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
data runtests: allow a test to switch off memdebug 2025-11-28 22:39:19 +01:00
http tests: fix formatting nits 2025-11-28 23:15:35 +01:00
libtest tests: fix formatting nits 2025-11-28 23:15:35 +01:00
server tests: fix formatting nits 2025-11-28 23:15:35 +01:00
tunit build: stop overriding standard memory allocation functions 2025-11-28 10:44:26 +01:00
unit tests: fix formatting nits 2025-11-28 23:15:35 +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: whitespace (more in Perl) 2025-07-12 08:59:44 +02:00
azure.pm runtests: fix quoting in Appveyor and Azure test integration 2023-04-22 11:50:03 -07:00
CMakeLists.txt tests: replace remaining CR bytes with the new macro %CR 2025-11-06 20:45:45 +01:00
config.in
configurehelp.pm.in build: use configurehelp.pm.in with autotools and cmake 2024-09-21 12:21:14 +02:00
devtest.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
dictserver.py badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
directories.pm scripts: fix perl indentation, whitespace, semicolons 2025-04-29 19:35:55 +02: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 badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
getpart.pm badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
globalconfig.pm runtests: add -m=seconds to override test curl command timeout 2025-11-19 22:04:52 +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
http-server.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
Makefile.am build: stop overriding standard memory allocation functions 2025-11-28 10:44:26 +01:00
memanalyze.pl memdebug: produce stack trace dump with libbacktrace 2025-11-24 11:58:18 +01:00
negtelnetserver.py badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
nghttpx.conf
pathhelp.pm badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
processhelp.pm badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +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 runtests: allow a test to switch off memdebug 2025-11-28 22:39:19 +01:00
runtests.pl runtests: allow a test to switch off memdebug 2025-11-28 22:39:19 +01:00
secureserver.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
serverhelp.pm badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
servers.pm badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
smbserver.py badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
sshhelp.pm runtests: fix test key format for libssh2 WinCNG (and others) 2025-03-23 20:26:26 +01:00
sshserver.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
test745.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test971.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1119.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1135.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1139.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1140.pl badwords: re-sync with curl-www, fix issues found 2025-11-12 00:53:44 +01:00
test1165.pl build: add build-level CURL_DISABLE_TYPECHECK options 2025-11-21 13:48:35 +01:00
test1167.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1173.pl badwords: add more contractions, fix fallouts 2025-11-17 19:29:15 +01:00
test1175.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1177.pl NTLM_WB: drop support 2024-04-08 13:58:58 +02:00
test1222.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1275.pl scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
test1276.pl scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
test1477.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1486.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1488.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
test1544.pl scripts: fix perl indentation, whitespace, semicolons 2025-04-29 19:35:55 +02:00
test1707.pl scripts: enable strict warnings in Perl where missing, fix fallouts 2025-07-27 22:35:18 +02:00
testcurl.pl badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
testutil.pm tests/data: more XML-compliance via %LT and %GT macros in email addresses 2025-11-18 18:57:53 +01:00
tftpserver.pl tidy-up: miscellaneous 2025-11-17 13:32:43 +01:00
util.py badwords: fix issues found in tests 2025-11-17 13:30:35 +01:00
valgrind.pm tests/valgrind.pm: fix warnings with no valgrind report to show 2024-09-20 15:40:07 +02:00
valgrind.supp hyper: drop support 2024-12-21 11:33:05 +01:00