vcpkg/ports/curl/0020-fix-pc-file.patch
Kai Pastor 6a9ecfd57f
[curl] Update (#18971)
* Modernize portfile

* Don't export implicit link libraries

* Revise osx framework handling

* Fix exported per-config location of dependencies

* Move curl-config to tools, incl. debug variant

* Update to 7.77.0

* Add WinIDN support and default IDN selection

* Use pkgconfig for libidn2 configuration

* Update to 0.78.0

* Remove obsolete nghttp2 staticlib patch

* Fix libs duplication in pc file

* Resolve transitive deps for pc file/curl-config

* x-add-version

* Fix winssl dependencies

* Add winldap feature, not default

* Update git-tree

Co-authored-by: past-due <30942300+past-due@users.noreply.github.com>
2021-08-11 19:38:08 -07:00

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(_libtype "${_libname}" TYPE)
@@ -1473,12 +1492,26 @@ foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
# 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()