From c7bd2d0d974a2246641c5523ee95beb6e06d6762 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Mar 2021 09:04:56 -0400 Subject: 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 --- Modules/FindPkgConfig.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 "") -- cgit v0.12