]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CMake: ignore INTERFACE_LIBRARY targets for pkg-config file
authorPeter Wu <peter@lekensteyn.nl>
Thu, 4 Jun 2020 09:28:01 +0000 (11:28 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 21 Jun 2020 17:37:28 +0000 (19:37 +0200)
Reviewed-by: Marcel Raad
Fixes #5512
Closes #5517

CMakeLists.txt

index a13395db7957282b67d855072d6c0a45df8c9ae4..5a1333397ff44f5da14f8af079d30403d7fb3a97 100644 (file)
@@ -1413,7 +1413,15 @@ set(libdir                  "${CMAKE_INSTALL_PREFIX}/lib")
 foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
   if(TARGET "${_lib}")
     set(_libname "${_lib}")
-    get_target_property(_lib "${_lib}" LOCATION)
+    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.
+      continue()
+    endif()
+    get_target_property(_lib "${_libname}" LOCATION)
     if(NOT _lib)
       message(WARNING "Bad lib in library list: ${_libname}")
       continue()