summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-02-21 20:56:03 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-02-21 20:56:03 (GMT)
commit7d4074e1f84f7780a8b6593afc4077ae73f7622e (patch)
tree5e2d3713fc38db9b9e14743256f44c9e58c8cc6c /Modules
parentae616023855d4e3772faa424fbf9970143a66b63 (diff)
parent27501155c7bcc04ada498407ad3d6fd40dbea2bd (diff)
downloadCMake-7d4074e1f84f7780a8b6593afc4077ae73f7622e.zip
CMake-7d4074e1f84f7780a8b6593afc4077ae73f7622e.tar.gz
CMake-7d4074e1f84f7780a8b6593afc4077ae73f7622e.tar.bz2
Merge topic 'improve-findpkgconfig'
2750115 FindPkgConfig: support version selection of pkg-config itself
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPkgConfig.cmake21
1 files changed, 16 insertions, 5 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index ce58899..5d93ab1 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -13,14 +13,17 @@
# When the 'QUIET' argument is set, no status messages will be printed.
#
# It sets the following variables:
-# PKG_CONFIG_FOUND ... true if pkg-config works on the system
-# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
-# <PREFIX>_FOUND ... set to 1 if module(s) exist
+# PKG_CONFIG_FOUND ... true if pkg-config works on the system
+# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
+# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+# (since CMake 2.8.8)
+# PKG_CONFIG_FOUND ... if pkg-config executable was found
#
# For the following variables two sets of values exist; first one is the
# common one and has the given PREFIX. The second set contains flags
# which are given out when pkgconfig was called with the '--static'
# option.
+# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
@@ -89,9 +92,17 @@ set(PKG_CONFIG_VERSION 1)
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-find_package_handle_standard_args(PkgConfig DEFAULT_MSG PKG_CONFIG_EXECUTABLE)
+if (PKG_CONFIG_EXECUTABLE)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif (PKG_CONFIG_EXECUTABLE)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(PkgConfig
+ REQUIRED_VARS PKG_CONFIG_EXECUTABLE
+ VERSION_VAR PKG_CONFIG_VERSION_STRING)
# Unsets the given variables
macro(_pkgconfig_unset var)