1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 19:08:07 +08:00

FindPkgConfig: Restore preference for first pkg-config in PATH

Since commit ab8bd48352 (FindPkgConfig: Search for pkg-config.bat file
on a Windows host, 2020-09-25, v3.19.0-rc1~98^2) we prefer
`pkg-config.bat` over `pkg-config` regardless of the order they appear
in the `PATH`.  Tell `find_program` to consider all names in each
directory so that the first one in `PATH` of any name wins.

Issue: #21239
This commit is contained in:
Brad King
2021-03-16 09:04:56 -04:00
parent 22612dd53a
commit c7bd2d0d97

View File

@@ -37,7 +37,10 @@ if(CMAKE_HOST_WIN32)
list(PREPEND PKG_CONFIG_NAMES "pkg-config.bat")
endif()
find_program(PKG_CONFIG_EXECUTABLE NAMES ${PKG_CONFIG_NAMES} DOC "pkg-config executable")
find_program(PKG_CONFIG_EXECUTABLE
NAMES ${PKG_CONFIG_NAMES}
NAMES_PER_DIR
DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
set(_PKG_CONFIG_FAILURE_MESSAGE "")