summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-28 09:48:38 -0500
committerCMake Topic Stage <kwrobot@kitware.com>2014-02-28 09:48:38 -0500
commiteafd2a8511cc6e88db1c3f868d86a1cd57d47e9a (patch)
tree9d547f29ea8ec372d263f1c89a2e6809f76d3928
parente62102bef1c24c843e81e7c7da7a65c360afc7e3 (diff)
parent80aa18b4a88d83e630acf5655025b14af0c76475 (diff)
downloadcmake-eafd2a8511cc6e88db1c3f868d86a1cd57d47e9a.tar.gz
Merge topic 'FindPkgConfig-PKG_CONFIG'
80aa18b4 Help: Add release notes for topic 'FindPkgConfig-PKG_CONFIG' c53b5cd2 FindPkgConfig: Prefer PKG_CONFIG to find pkg-config (#13175)
-rw-r--r--Help/release/dev/FindPkgConfig-PKG_CONFIG.rst5
-rw-r--r--Modules/FindPkgConfig.cmake14
2 files changed, 17 insertions, 2 deletions
diff --git a/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst b/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst
new file mode 100644
index 0000000000..c0f64711a6
--- /dev/null
+++ b/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst
@@ -0,0 +1,5 @@
+FindPkgConfig-PKG_CONFIG
+------------------------
+
+* The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG``
+ environment variable value as the ``pkg-config`` executable, if set.
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index e6fdefe8c1..7179d17d8e 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -6,6 +6,11 @@
#
#
#
+# To find the pkg-config executable, it uses the variable
+# PKG_CONFIG_EXECUTABLE or the environment variable PKG_CONFIG first.
+#
+#
+#
# Usage:
#
# ::
@@ -134,8 +139,9 @@
# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+# Copyright 2006-2014 Kitware, Inc.
+# Copyright 2014 Christoph GrĂ¼ninger <foss@grueninger.de>
+# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -150,6 +156,10 @@
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
+# find pkg-config, use PKG_CONFIG if set
+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")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)