From: Viktor Szakats Date: Wed, 14 Jan 2026 12:04:18 +0000 (+0100) Subject: cmake: avoid setting custom property on built-in interface targets X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6437bd79ae8c67066728a83ed62edee48e596bdd;p=thirdparty%2Fcurl.git cmake: avoid setting custom property on built-in interface targets In some cases `ZLIB::ZLIB` and/or `OpenSSL::SSL` may be aliases, which prevents setting a curl-specific property (.pc module name) in them: ``` CMake Error at [...]/curl/CMakeLists.txt:910 (set_target_properties): set_target_properties can not be used on an ALIAS target. ``` Fix by special-casing these built-in targets and manually converting them to .pc module names, without using the targets themselves to carry this information throughout curl's internal build logic. Reported-by: Tomáš Malý Fixes #20313 Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973 Closes #20316 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e70d47563c..55d88d69d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -767,7 +767,6 @@ if(CURL_USE_OPENSSL) # Depend on OpenSSL via imported targets. This allows our dependents to # get our dependencies transitively. list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto) - set_target_properties(OpenSSL::SSL PROPERTIES INTERFACE_LIBCURL_PC_MODULES "openssl") if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "openssl") set(_valid_default_ssl_backend TRUE) @@ -907,7 +906,6 @@ if(ZLIB_FOUND) # Depend on ZLIB via imported targets. This allows our dependents to # get our dependencies transitively. list(APPEND CURL_LIBS ZLIB::ZLIB) - set_target_properties(ZLIB::ZLIB PROPERTIES INTERFACE_LIBCURL_PC_MODULES "zlib") endif() set(HAVE_BROTLI OFF) @@ -2154,7 +2152,13 @@ if(NOT CURL_DISABLE_INSTALL) if(NOT _libname AND NOT _libs AND NOT _libdirs) message(WARNING "Bad lib in library list: ${_lib}") endif() - get_target_property(_modules "${_lib}" INTERFACE_LIBCURL_PC_MODULES) + if(_lib STREQUAL OpenSSL::SSL) + set(_modules "openssl") + elseif(_lib STREQUAL ZLIB::ZLIB) + set(_modules "zlib") + else() + get_target_property(_modules "${_lib}" INTERFACE_LIBCURL_PC_MODULES) + endif() if(_modules) list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "${_modules}") endif()