Skip to content

Commit

Permalink
[vcpkg/scripts] Only add pkgconfig_path if it is not already on PATH (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
Neumann-A authored Apr 20, 2024
1 parent b346ee3 commit 9224b3b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/cmake/z_vcpkg_setup_pkgconfig_path.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ function(z_vcpkg_setup_pkgconfig_path)

vcpkg_find_acquire_program(PKGCONFIG)
get_filename_component(pkgconfig_path "${PKGCONFIG}" DIRECTORY)
vcpkg_add_to_path("${pkgconfig_path}")
cmake_path(CONVERT "$ENV{PATH}" TO_CMAKE_PATH_LIST path_list NORMALIZE)
cmake_path(CONVERT "${pkgconfig_path}" TO_CMAKE_PATH_LIST pkgconfig_path NORMALIZE)
if(NOT "${pkgconfig_path}" IN_LIST path_list)
vcpkg_add_to_path("${pkgconfig_path}")
endif()
unset(path_list)
unset(pkgconfig_path)

set(ENV{PKG_CONFIG} "${PKGCONFIG}") # Set via native file?
set(ENV{PKG_CONFIG} "${PKGCONFIG}")

foreach(prefix IN ITEMS "${CURRENT_INSTALLED_DIR}" "${CURRENT_PACKAGES_DIR}")
vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH} "${prefix}/share/pkgconfig")
Expand Down

0 comments on commit 9224b3b

Please sign in to comment.