summaryrefslogtreecommitdiffstats
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
authorBenjamin Chrétien <chretien@lirmm.fr>2015-10-27 04:21:50 (GMT)
committerBrad King <brad.king@kitware.com>2015-10-28 14:18:15 (GMT)
commit1bfb527f561c705169f0716108e34a2b5ba5c8bb (patch)
tree1a63cbf0aba48a4ae1c59a83ec2b21e11b704095 /Modules/FindPkgConfig.cmake
parent2fd5fd1f4d93322e85d662c1467a46cd7da84560 (diff)
downloadCMake-1bfb527f561c705169f0716108e34a2b5ba5c8bb.zip
CMake-1bfb527f561c705169f0716108e34a2b5ba5c8bb.tar.gz
CMake-1bfb527f561c705169f0716108e34a2b5ba5c8bb.tar.bz2
FindPkgConfig: return actual error when a package is not found (#15810)
In some cases, CMake returned the following error: -- Checking for module 'foo' -- Package 'foo' not found When the actual error returned by pkg-config was: Package 'bar', required by 'foo', not found Now, the actual error is forwarded to the user. -- Checking for module 'foo' -- Package 'bar', required by 'foo', not found For the standard case (i.e. the package was indeed not found), the CMake error was: -- Checking for module 'foo' -- Package 'foo' not found But it now prints: -- Checking for module 'foo' -- No package 'foo' found The associated test was also updated. ${last} refers to the last CLI argument.
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index e822b9c..d519c1d 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -328,7 +328,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
if (_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
else()
- list(APPEND _pkg_check_modules_exist_query --exists)
+ list(APPEND _pkg_check_modules_exist_query --exists --print-errors --short-errors)
endif()
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
@@ -342,12 +342,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
# execute the query
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
- RESULT_VARIABLE _pkgconfig_retval)
+ RESULT_VARIABLE _pkgconfig_retval
+ ERROR_VARIABLE _pkgconfig_error
+ ERROR_STRIP_TRAILING_WHITESPACE)
# evaluate result and tell failures
if (_pkgconfig_retval)
if(NOT ${_is_silent})
- message(STATUS " Package '${_pkg_check_modules_pkg}' not found")
+ message(STATUS " ${_pkgconfig_error}")
endif()
set(_pkg_check_modules_failed 1)