Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/cmake/vcpkg_fixup_pkgconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ function(vcpkg_fixup_pkgconfig)
# Once this transformation is complete, users of vcpkg should never need to pass
# --static.
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
if(_contents MATCHES "\nLibs.private: *([^\n]*[^ \n])")
# If the software already merges Libs.private into Libs (e.g. curl), avoid duplication.
set(_libs_private "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\nLibs: *([^\n]*[^ \n])" "\nLibs: @VCPKG_FIXUP_LIBS@" _contents "${_contents}")
string(REPLACE " ${_libs_private} " " " _libs " ${CMAKE_MATCH_1} ")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes a space will be present after the _libs_private sequence in Libs:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there is an extra space before and after ${CMAKE_MATCH_1} here, so the assumption will hold.

string(REPLACE "@VCPKG_FIXUP_LIBS@" "${_libs}" _contents "${_contents}")
endif()
# Libs comes before Libs.private
string(REGEX REPLACE "(^|\n)(Libs: [^\n]*)(.*)\nLibs.private:( [^\n]*)" "\\1\\2\\4\\3" _contents "${_contents}")
# Libs.private comes before Libs
Expand Down