summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Rasin <boris@pointx.org>2021-10-20 17:34:19 +0300
committerDaniel Stenberg <daniel@haxx.se>2021-10-28 16:13:06 +0200
commit399ef7a53ce076dd46208030cd22aaf07d308fce (patch)
treee1201e6495c7b31d2896b23da825b6f98fcc475f
parentd55b8b6a45b20898cf3c0ea621c32bc296c67383 (diff)
downloadcurl-399ef7a53ce076dd46208030cd22aaf07d308fce.tar.gz
cmake: fix error getting LOCATION property on non-imported target
Closes #7885
-rw-r--r--CMakeLists.txt10
1 files changed, 4 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9715b9f98..a88f49b3b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)