]> git.ipfire.org Git - thirdparty/curl.git/commit
cmake: skip binutils ld hack if zlib/openssl target is not `IMPORTED`
authorViktor Szakats <commit@vsz.me>
Sat, 31 Jan 2026 20:15:51 +0000 (21:15 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 2 Feb 2026 11:28:12 +0000 (12:28 +0100)
commit4f1646ef8a9ae3052ee3e13a09c418de9ec85819
tree077d83fde7b5be7158a4c78c0beb615e5e44d95b
parent96fa42c7c03fc54c9d8311355253fadc3d5240f2
cmake: skip binutils ld hack if zlib/openssl target is not `IMPORTED`

The binutils ld hack requires reading the targets' `LOCATION` property.
This property exists in `IMPORTED` targets. `ZLIB::ZLIB` and
`OpenSSL::Crypto` are normally `IMPORTED` targets defined by CMake's
built-in Find modules. However, in some cases (e.g. in "superbuilds"),
they may be regular targets, defined manually, without a `LOCATION`
property. To avoid a CMake warning in such case, verify if the target is
`IMPORTED` before reading this property.

This also mean that in such case the binutils/ld/gcc hack is not
enabled, and libcurl may fail linking in static mode.

https://cmake.org/cmake/help/v4.2/prop_tgt/IMPORTED.html
https://cmake.org/cmake/help/v4.2/prop_tgt/LOCATION.html

Reported-by: Tomáš Malý
Fixes #20419
Follow-up to 3e841630ece59c04e26058a761302f38370fd0cc #20427
Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973

Closes #20486
CMakeLists.txt