Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion scripts/cmake/vcpkg_fixup_pkgconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ function(z_vcpkg_fixup_pkgconfig_process_data arg_variable arg_config arg_prefix
elseif(item MATCHES "^(-l|-L)?general")
continue()
endif()
if(item MATCHES "[\$`\"\\ ]")
if(item MATCHES [[.[\$]| ]] AND NOT item MATCHES [["]])
set(item "\"${item}\"")
else()
set(quoted "\"${item}\"")
string(FIND " ${libs} " " ${quoted} " index)
if(NOT index STREQUAL "-1")
set(item "${quoted}")
endif()
endif()
list(APPEND libs_filtered "${item}")
endforeach()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ function(unit_test_pkgconfig_check_key build_types field value)
set(expected "${field}${value}")
list(FILTER ${listname} INCLUDE REGEX "^${field}")
if(NOT "${${listname}}" STREQUAL "${expected}" AND NOT "${${listname}}_is_empty" STREQUAL "${value}_is_empty")
string(REPLACE "\$" "\\\$" pc_strings_INPUT "${pc_strings_INPUT}")
string(REPLACE "\$" "\\\$" expected "${expected}")
string(REPLACE "\$" "\\\$" "${listname}" "${${listname}}")
message(SEND_ERROR "vcpkg_fixup_pkgconfig() resulted in a wrong value for ${build_type} builds;
input: [[${pc_strings_INPUT}]]
input : [[${pc_strings_INPUT}]]
expected: [[${expected}]]
actual : [[${${listname}}]]")
set_has_error()
Expand Down Expand Up @@ -157,3 +160,8 @@ unit_test_pkgconfig_check_key("debug" "datadir=" [[${datarootdir}/unit-test-cmak
write_pkgconfig([[blah_libs=-L${blah}/lib64 -l${blah}/libblah.a -I${blah}/include]])
unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]])
unit_test_pkgconfig_check_key("debug;release" "blah_libs=" [["-L${blah}/lib64" "-l${blah}/libblah.a" "-I${blah}/include"]])

# plain vs. quoted items
write_pkgconfig([[Libs: ${blah} "${quoted}" plain "C:/Program Files/blah.lib"]])
unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]])
unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ ${blah} "${quoted}" plain "C:/Program Files/blah.lib"]])