[Cmake-commits] CMake branch, next, updated. v3.3.2-3080-g244bb3c
Ben Boeckel
ben.boeckel at kitware.com
Fri Sep 18 13:20:35 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 244bb3caa32a08d6719f0f3f1b63509e5373372f (commit)
via 70e8db6e20749a484dd677d7094780c5f4b451c6 (commit)
via 7f7f1eecfd6834b8a499f0fde49469a10a1b2905 (commit)
from 53a6318c7a9afa8de467665f6c78e18ce6c3b43d (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=244bb3caa32a08d6719f0f3f1b63509e5373372f
commit 244bb3caa32a08d6719f0f3f1b63509e5373372f
Merge: 53a6318 70e8db6
Author: Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Sep 18 13:20:34 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Sep 18 13:20:34 2015 -0400
Merge topic 'pkg-config-variable-function' into next
70e8db6e FindPkgConfig: add a command to query arbitrary variables
7f7f1eec FindPkgConfig: use execute_process to strip trailing whitespace
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70e8db6e20749a484dd677d7094780c5f4b451c6
commit 70e8db6e20749a484dd677d7094780c5f4b451c6
Author: Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Thu Sep 17 21:05:29 2015 -0400
Commit: Ben Boeckel <mathstuf at gmail.com>
CommitDate: Thu Sep 17 21:08:19 2015 -0400
FindPkgConfig: add a command to query arbitrary variables
diff --git a/Help/release/dev/pkg-config-variable-function.rst b/Help/release/dev/pkg-config-variable-function.rst
new file mode 100644
index 0000000..e181d13
--- /dev/null
+++ b/Help/release/dev/pkg-config-variable-function.rst
@@ -0,0 +1,6 @@
+pkg-config-variable-function
+----------------------------
+
+* The :module:`FindPkgConfig` learned a new :command:`pkg_get_variable`
+ command which may be used to query for arbitrary variables from a package
+ (such as for related tools or data and plugin install paths).
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 0f2e22d..9c725fc 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -91,6 +91,26 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
endif()
endmacro()
+#[========================================[.rst:
+.. command:: pkg_get_variable
+
+ Retrieves the value of a variable from a package. ::
+
+ pkg_get_variable(<RESULT> <MODULE> <VARIABLE>)
+
+ Examples
+
+ .. code-block:: cmake
+
+ pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)
+#]========================================]
+function (pkg_get_variable result pkg variable)
+ _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
+ set("${result}"
+ "${prefix_result}"
+ PARENT_SCOPE)
+endfunction ()
+
# Invokes pkgconfig two times; once without '--static' and once with
# '--static'
macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
@@ -356,9 +376,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
endif()
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
- _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
+ pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix")
+ pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir")
+ pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir")
if (NOT ${_is_silent})
message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
new file mode 100644
index 0000000..5f211eb
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
@@ -0,0 +1 @@
+-- g_ir_scanner: .*/g-ir-scanner
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake
new file mode 100644
index 0000000..c85efaa
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake
@@ -0,0 +1,9 @@
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GOBJECT_INTROSPECTION QUIET gobject-introspection-1.0)
+
+if (GOBJECT_INTROSPECTION_FOUND)
+ pkg_get_variable(g_ir_scanner gobject-introspection-1.0 g_ir_scanner)
+ message(STATUS "g_ir_scanner: ${g_ir_scanner}")
+else ()
+ message(STATUS "g_ir_scanner: skipping test; gobject-introspection-1.0 not found /g-ir-scanner")
+endif ()
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index 29301d7..bb04aa2 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -9,3 +9,9 @@ if(APPLE)
run_cmake(FindPkgConfig_CMAKE_FRAMEWORK_PATH)
run_cmake(FindPkgConfig_CMAKE_APPBUNDLE_PATH)
endif()
+
+# We need a real pkg-config to run the test for get_variable.
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+ run_cmake(FindPkgConfig_GET_VARIABLE)
+endif ()
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f7f1eecfd6834b8a499f0fde49469a10a1b2905
commit 7f7f1eecfd6834b8a499f0fde49469a10a1b2905
Author: Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Thu Sep 17 21:08:05 2015 -0400
Commit: Ben Boeckel <mathstuf at gmail.com>
CommitDate: Thu Sep 17 21:08:19 2015 -0400
FindPkgConfig: use execute_process to strip trailing whitespace
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index ae6903e..0f2e22d 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -70,14 +70,14 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
OUTPUT_VARIABLE _pkgconfig_invoke_result
- RESULT_VARIABLE _pkgconfig_failed)
+ RESULT_VARIABLE _pkgconfig_failed
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
if (_pkgconfig_failed)
set(_pkgconfig_${_varname} "")
_pkgconfig_unset(${_prefix}_${_varname})
else()
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
- string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
if (NOT ${_regexp} STREQUAL "")
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
-----------------------------------------------------------------------
Summary of changes:
Help/release/dev/pkg-config-variable-function.rst | 6 ++++
Modules/FindPkgConfig.cmake | 30 ++++++++++++++++----
.../FindPkgConfig_GET_VARIABLE-stdout.txt | 1 +
.../FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake | 9 ++++++
Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake | 6 ++++
5 files changed, 47 insertions(+), 5 deletions(-)
create mode 100644 Help/release/dev/pkg-config-variable-function.rst
create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list