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