From: Viktor Szakats Date: Fri, 6 Mar 2026 02:42:41 +0000 (+0100) Subject: cmake: fix `LOCATION` property read errors in target debug function X-Git-Tag: curl-8_19_0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6cfb2a2f34df80c6d746d1cb07705d3fac7e67a;p=thirdparty%2Fcurl.git cmake: fix `LOCATION` property read errors in target debug function Exclude reading certain props for certain target types to avoid these errors: ``` CMake Error at CMake/Utilities.cmake:71 (get_property): The LOCATION property may not be read from target "...". Use the target name directly with add_custom_command, or use the generator expression $, as appropriate. ``` (and the same in line 78.) Follow-up to 855acb3bb07e0dd06b5722218eb5fded333f7ce0 #17701 Closes #20828 --- diff --git a/CMake/Utilities.cmake b/CMake/Utilities.cmake index efa28b7515..7d2c8328e1 100644 --- a/CMake/Utilities.cmake +++ b/CMake/Utilities.cmake @@ -60,6 +60,10 @@ function(curl_dumptargetprops _target) list(REMOVE_DUPLICATES _cmake_property_list) list(REMOVE_ITEM _cmake_property_list "") list(APPEND _cmake_property_list "INTERFACE_LIBCURL_PC_MODULES") + get_target_property(_target_type ${_target} TYPE) + if(NOT _target_type MATCHES "(INTERFACE_LIBRARY|UNKNOWN_LIBRARY)") + list(REMOVE_ITEM _cmake_property_list "LOCATION" "LOCATION_" "MACOSX_PACKAGE_LOCATION" "VS_DEPLOYMENT_LOCATION") + endif() foreach(_prop IN LISTS _cmake_property_list) if(_prop MATCHES "") foreach(_config IN ITEMS "DEBUG" "RELEASE" "MINSIZEREL" "RELWITHDEBINFO")