summaryrefslogtreecommitdiffstats
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-03-16 13:04:56 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-16 13:04:56 (GMT)
commitc7bd2d0d974a2246641c5523ee95beb6e06d6762 (patch)
tree7bb6da2584929eccdcb138d014f45da6f4d3d552 /Modules/FindPkgConfig.cmake
parent22612dd53a46c7f9b4c3f4b7dbe5c78f9afd9581 (diff)
downloadCMake-c7bd2d0d974a2246641c5523ee95beb6e06d6762.zip
CMake-c7bd2d0d974a2246641c5523ee95beb6e06d6762.tar.gz
CMake-c7bd2d0d974a2246641c5523ee95beb6e06d6762.tar.bz2
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
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 2ad2c7e..360f439 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -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 "")