Skip to content

Commit

Permalink
cmake: fix error getting LOCATION property on non-imported target
Browse files Browse the repository at this point in the history
Closes #7885
  • Loading branch information
Boris-Rasin authored and bagder committed Oct 28, 2021
1 parent d55b8b6 commit 399ef7a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions CMakeLists.txt
Expand Up @@ -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)
Expand Down

0 comments on commit 399ef7a

Please sign in to comment.