]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: fix `LOCATION` property read errors in target debug function
authorViktor Szakats <commit@vsz.me>
Fri, 6 Mar 2026 02:42:41 +0000 (03:42 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 6 Mar 2026 03:04:09 +0000 (04:04 +0100)
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
  $<TARGET_FILE>, as appropriate.
```
(and the same in line 78.)

Follow-up to 855acb3bb07e0dd06b5722218eb5fded333f7ce0 #17701

Closes #20828

CMake/Utilities.cmake

index efa28b75155b0651f18313637b01be2635d1f3d0..7d2c8328e1e1ba43213693354eefc58db7c80f49 100644 (file)
@@ -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_<CONFIG>" "MACOSX_PACKAGE_LOCATION" "VS_DEPLOYMENT_LOCATION")
+    endif()
     foreach(_prop IN LISTS _cmake_property_list)
       if(_prop MATCHES "<CONFIG>")
         foreach(_config IN ITEMS "DEBUG" "RELEASE" "MINSIZEREL" "RELWITHDEBINFO")