summaryrefslogtreecommitdiffstats
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
authorChristoph GrĂ¼ninger <foss@grueninger.de>2014-02-26 19:48:18 (GMT)
committerBrad King <brad.king@kitware.com>2014-02-27 15:29:01 (GMT)
commitc53b5cd2215a25e0661cbaf88b22664d1ec09412 (patch)
treeca57ce4dca1d9401671722754bd06c34ac1e87bb /Modules/FindPkgConfig.cmake
parent01981d8e45a60a66f3140a981c0bc1e7fe2ea804 (diff)
downloadCMake-c53b5cd2215a25e0661cbaf88b22664d1ec09412.zip
CMake-c53b5cd2215a25e0661cbaf88b22664d1ec09412.tar.gz
CMake-c53b5cd2215a25e0661cbaf88b22664d1ec09412.tar.bz2
FindPkgConfig: Prefer PKG_CONFIG to find pkg-config (#13175)
If the environment variable PKG_CONFIG is set, use this as the default pkg-config executable.
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index e6fdefe..7179d17 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)