summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-28 12:44:03 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-09-28 12:44:09 (GMT)
commit9e0da9ea2b5340d730a685ff87940a1aedfd66dd (patch)
treeb031c8c7c8e21ec8b641a8ec7dfcd9b71e8cdf19 /Modules
parentc442c59757fd57fa6ddaa4b0b2d49bd8524facca (diff)
parentab8bd48352df060c4ead210fe30dc4736646206b (diff)
downloadCMake-9e0da9ea2b5340d730a685ff87940a1aedfd66dd.zip
CMake-9e0da9ea2b5340d730a685ff87940a1aedfd66dd.tar.gz
CMake-9e0da9ea2b5340d730a685ff87940a1aedfd66dd.tar.bz2
Merge topic 'pkg_config_detailed_error'
ab8bd48352 FindPkgConfig: Search for pkg-config.bat file on a Windows host 3201dd521e FindPkgConfig: Show more info when pkg-config --version fails Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5273
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPkgConfig.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 93827d8..2ad2c7e 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -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 "")
@@ -47,7 +53,9 @@ if (PKG_CONFIG_EXECUTABLE)
string(APPEND _PKG_CONFIG_FAILURE_MESSAGE
"The command\n"
" \"${PKG_CONFIG_EXECUTABLE}\" --version\n"
- " failed with output\n${_PKG_CONFIG_VERSION_ERROR}"
+ " failed with output:\n${PKG_CONFIG_VERSION_STRING}\n"
+ " stderr: \n${_PKG_CONFIG_VERSION_ERROR}\n"
+ " result: \n${_PKG_CONFIG_VERSION_RESULT}"
)
set(PKG_CONFIG_EXECUTABLE "")
unset(PKG_CONFIG_VERSION_STRING)