]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: fix error getting LOCATION property on non-imported target
authorBoris Rasin <boris@pointx.org>
Wed, 20 Oct 2021 14:34:19 +0000 (17:34 +0300)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 28 Oct 2021 14:13:06 +0000 (16:13 +0200)
Closes #7885

CMakeLists.txt

index 9715b9f984efd146640fdf4d13a50b7a001605e4..a88f49b3b487338f23acc2d8b5a7f0c7461568bc 100644 (file)
@@ -1494,12 +1494,10 @@ set(libdir                  "${CMAKE_INSTALL_PREFIX}/lib")
 foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
   if(TARGET "${_lib}")
     set(_libname "${_lib}")
-    get_target_property(_libtype "${_libname}" TYPE)
-    if(_libtype STREQUAL INTERFACE_LIBRARY)
-      # Interface libraries can occur when an external project embeds curl and
-      # defined targets such as ZLIB::ZLIB by themselves. Ignore these as
-      # reading the LOCATION property will error out. Assume the user won't need
-      # this information in the .pc file.
+    get_target_property(_imported "${_libname}" IMPORTED)
+    if(NOT _imported)
+      # Reading the LOCATION property on non-imported target will error out.
+      # Assume the user won't need this information in the .pc file.
       continue()
     endif()
     get_target_property(_lib "${_libname}" LOCATION)