mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 20:39:00 +08:00
d320e1a2d6
* Update to 7.80 * Add 'lib' prefix to exported config for windows * Update versions * Export static dependencies as -l<name> * Update versions
60 lines
2.0 KiB
Diff
60 lines
2.0 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 8b2e428..ea430f4 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -1462,7 +1462,26 @@ set(includedir "\${prefix}/include")
|
|
set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
|
set(LIBCURL_LIBS "")
|
|
set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
|
|
-foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
|
|
+function(flatten input output)
|
|
+ set(output_libs "${${output}}")
|
|
+ set(input_libs "${${input}}")
|
|
+ while(input_libs)
|
|
+ list(POP_BACK input_libs lib)
|
|
+ if(NOT "${lib}" IN_LIST output_libs)
|
|
+ if(TARGET "${lib}")
|
|
+ get_target_property(link_libs "${lib}" INTERFACE_LINK_LIBRARIES)
|
|
+ if(link_libs)
|
|
+ flatten(link_libs output_libs)
|
|
+ endif()
|
|
+ endif()
|
|
+ list(PREPEND output_libs "${lib}")
|
|
+ endif()
|
|
+ endwhile()
|
|
+ set("${output}" "${output_libs}" PARENT_SCOPE)
|
|
+endfunction()
|
|
+set(CURL_LIBS_FLAT "")
|
|
+flatten(CURL_LIBS CURL_LIBS_FLAT)
|
|
+foreach(_lib ${CURL_LIBS_FLAT})
|
|
if(TARGET "${_lib}")
|
|
set(_libname "${_lib}")
|
|
get_target_property(_imported "${_libname}" IMPORTED)
|
|
@@ -1503,12 +1523,26 @@ foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
|
|
# Assume the user won't need this information in the .pc file.
|
|
continue()
|
|
endif()
|
|
+ set(_lib NOTFOUND)
|
|
+ if(DEFINED CMAKE_BUILD_TYPE)
|
|
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" config)
|
|
+ get_target_property(_lib "${_libname}" IMPORTED_LOCATION_${config})
|
|
+ endif()
|
|
+ if(NOT _lib)
|
|
get_target_property(_lib "${_libname}" LOCATION)
|
|
+ endif()
|
|
if(NOT _lib)
|
|
message(WARNING "Bad lib in library list: ${_libname}")
|
|
continue()
|
|
endif()
|
|
endif()
|
|
+ if(_lib MATCHES "^(.*)/([^/]*)[.]framework$")
|
|
+ if(CMAKE_MATCH_1 IN_LIST CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES)
|
|
+ set(_lib "-framework ${CMAKE_MATCH_2}")
|
|
+ else()
|
|
+ set(_lib "-framework ${_lib}")
|
|
+ endif()
|
|
+ endif()
|
|
if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-")
|
|
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
|
|
else()
|