mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 15:32:10 +08:00
FindPkgConfig: Search for pkg-config.bat file on a Windows host
The strawberry perl distribution ships a pkg-config file and a pkg-config.bat file. find_program() does not usually look for a .bat file program unless explicitly specified in the NAMES argument. This would cause CMake to find the non-bat file, and executing that with execute_process() leads to a '%1 is not a valid Win32 application' error. Prefer to search for pkg-config.bat file when on a Windows host, in additiona to the regular pkg-config file. Fixes: #21239
This commit is contained in:
@@ -31,7 +31,13 @@ set(PKG_CONFIG_VERSION 1)
|
||||
if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL ""))
|
||||
set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable")
|
||||
endif()
|
||||
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
|
||||
|
||||
set(PKG_CONFIG_NAMES "pkg-config")
|
||||
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")
|
||||
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
set(_PKG_CONFIG_FAILURE_MESSAGE "")
|
||||
|
Reference in New Issue
Block a user