[Cmake-commits] CMake branch, next, updated. v3.4.0-rc2-1166-gf14b0bb

Brad King brad.king at kitware.com
Wed Oct 28 10:22:27 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  f14b0bbbf19f09d914635688d325f72dfd450898 (commit)
       via  1bfb527f561c705169f0716108e34a2b5ba5c8bb (commit)
      from  39a3b09a53ea3b8334153b97805ff4cd99593386 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f14b0bbbf19f09d914635688d325f72dfd450898
commit f14b0bbbf19f09d914635688d325f72dfd450898
Merge: 39a3b09 1bfb527
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 28 10:22:24 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 28 10:22:24 2015 -0400

    Merge topic 'FindPkgConfig-better-error' into next
    
    1bfb527f FindPkgConfig: return actual error when a package is not found (#15810)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bfb527f561c705169f0716108e34a2b5ba5c8bb
commit 1bfb527f561c705169f0716108e34a2b5ba5c8bb
Author:     Benjamin Chrétien <chretien at lirmm.fr>
AuthorDate: Tue Oct 27 13:21:50 2015 +0900
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 28 10:18:15 2015 -0400

    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.

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)
diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
index 852e841..abe14bf 100755
--- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
+++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
@@ -10,9 +10,10 @@ case $1 in
     ;;
   --exists)
     shift
-    echo "Expected: $@"
+    eval last=\${$#}
+    echo "Expected: ${last}"
     echo "Found:    ${PKG_CONFIG_PATH}"
-    [ "$@" = "${PKG_CONFIG_PATH}" ] || exit 1
+    [ "${last}" = "${PKG_CONFIG_PATH}" ] || exit 1
     ;;
   *)
     exit 255

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindPkgConfig.cmake                      |    8 +++++---
 Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh |    5 +++--
 2 files changed, 8 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list