Skip to content

Commit

Permalink
[vcpkg_fixup_pkgconfig] Fix lib names starting with debug/optimized/g…
Browse files Browse the repository at this point in the history
…eneral (microsoft#39227)

Thanks for the fix and the tests!
  • Loading branch information
dg0yt authored Jun 13, 2024
1 parent f007eb1 commit 94a50e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/cmake/vcpkg_fixup_pkgconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ function(z_vcpkg_fixup_pkgconfig_process_data arg_variable arg_config arg_prefix
if(skip_next)
set(skip_next 0)
continue()
elseif(item MATCHES "^(-l|-L)?optimized")
elseif(item MATCHES "^(-l|-L)?optimized\$")
string(COMPARE EQUAL "${arg_config}" "DEBUG" skip_next)
continue()
elseif(item MATCHES "^(-l|-L)?debug")
elseif(item MATCHES "^(-l|-L)?debug\$")
string(COMPARE EQUAL "${arg_config}" "RELEASE" skip_next)
continue()
elseif(item MATCHES "^(-l|-L)?general")
elseif(item MATCHES "^(-l|-L)?general\$")
continue()
endif()
if(item MATCHES [[.[\$]| ]] AND NOT item MATCHES [["]])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,22 @@ unit_test_pkgconfig_check_key("debug;release" "blah_libs=" [["-L${blah}/lib64" "
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"]])

# lib spec starting with optimized/debug/general
write_pkgconfig([[
Libs: -L${prefix}/lib -ldebuginfod
]])
unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]])
unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -ldebuginfod]])

write_pkgconfig([[
Libs: -L${prefix}/lib -loptimizedinfod
]])
unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]])
unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -loptimizedinfod]])

write_pkgconfig([[
Libs: -L${prefix}/lib -lgeneralinfod
]])
unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]])
unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -lgeneralinfod]])

0 comments on commit 94a50e8

Please sign in to comment.