curl-curl/CMake
Viktor Szakats fad1ebaecc
cmake: resolve imported targets recursively when generating libcurl.pc
To allow simplifying the binutils ld hack, by chaining the original
imported target to curl's local duplicate target. Also to allow linking
to dependencies' native imported targets via their CMake Configs, which
will always be hooked up to a `CURL::` interface, and may also be
chained upstream.

Fixing (seen on Linux with simplified binutils hack via #20839):
```
 Requires:
 Requires.private: libzstd openssl zlib
 Libs: -L${libdir} -lcurl
-Libs.private:  -lcrypto -lssl -lz -lzstd
+Libs.private:  -lOpenSSL::Crypto -lZLIB::ZLIB -lcrypto -lssl -lz -lzstd
 Cflags: -I${includedir}
 Cflags.private: -DCURL_STATICLIB
Error: Process completed with exit code
```
Ref: https://github.com/curl/curl/actions/runs/22768301699/job/66041980258?pr=20839

Note this makes it possible to run into an infinite loop because CMake
allows cyclic dependencies. It isn't added by curl's CMake script nor by
any dependencies as defined by default, but may happen in theory with
custom-created targets. In such case CMake automatically stops with
an error at 1000 iterations. I find it overkill to add custom protection
for it.

Cherry-picked from #20814
Cherry-picked from #20839

Closes #20840
2026-03-16 11:57:56 +01:00
..
cmake_uninstall.in.cmake cmake: match filename suffixes with file content 2025-12-20 11:34:27 +01:00
curl-config.in.cmake cmake: fix building with CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON 2026-03-03 16:33:21 +01:00
CurlSymbolHiding.cmake build: merge TrackMemory (CURLDEBUG) into debug-enabled option 2026-01-19 18:43:17 +01:00
CurlTests.c badwords: avoid 'simply' 2026-03-10 19:34:06 +01:00
FindBrotli.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindCares.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindGnuTLS.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindGSS.cmake cmake/FindGSS: add backtick missing from comment 2026-01-27 15:08:33 +01:00
FindLDAP.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindLibbacktrace.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindLibgsasl.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindLibidn2.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindLibpsl.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindLibrtmp.cmake cmake: replace deprecated OPENSSL_FOUND with OpenSSL_FOUND 2025-12-17 17:56:33 +01:00
FindLibssh2.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindLibssh.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindLibuv.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindMbedTLS.cmake cmake/FindMbedTLS: add workaround for missing static MSVC mbedcrypto.lib 4.0.0 2026-02-19 12:38:49 +01:00
FindNettle.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindNGHTTP2.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindNGHTTP3.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindNGTCP2.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
FindQuiche.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindRustls.cmake cmake/FindRustls: merge two ifs 2025-12-18 15:16:33 +01:00
FindWolfSSL.cmake cmake: define dependencies as IMPORTED interface targets 2025-11-29 01:41:40 +01:00
FindZstd.cmake cmke: add *_USE_STATIC_LIBS options for 9 dependencies 2026-01-26 05:21:24 +01:00
Macros.cmake cmake: resolve imported targets recursively when generating libcurl.pc 2026-03-16 11:57:56 +01:00
OtherTests.cmake build: check MSG_NOSIGNAL directly, drop detection and interim macro 2026-02-11 14:51:08 +01:00
PickyWarnings.cmake cmake: stop disabling C4774 after replacing snprintf(), update comment (MSVC) 2026-03-03 00:46:41 +01:00
unix-cache.cmake build: check MSG_NOSIGNAL directly, drop detection and interim macro 2026-02-11 14:51:08 +01:00
Utilities.cmake cmake: fix LOCATION property access condition (debug) 2026-03-06 15:35:27 +01:00
win32-cache.cmake build: drop unused snprintf() feature check on Windows 2026-03-02 22:40:29 +01:00