summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@collabora.co.uk>2011-01-17 12:31:44 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-01-17 12:31:44 (GMT)
commita13e97b42c89159667f2d89c7eda2dbfdf1465e8 (patch)
tree69156ba854317007a63436f2bc26fb9252756479 /mkspecs/features
parent32f3fcd9ab19f66cb435e6a8830ce54ccf13885a (diff)
downloadQt-a13e97b42c89159667f2d89c7eda2dbfdf1465e8.zip
Qt-a13e97b42c89159667f2d89c7eda2dbfdf1465e8.tar.gz
Qt-a13e97b42c89159667f2d89c7eda2dbfdf1465e8.tar.bz2
Add packagesExist() function to qmake.
This can be used to detect whether or not a given (set of) packages exist, which can be useful for compiling in or our extra functionality at build time. Merge-request: 1022 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/link_pkgconfig.prf3
-rw-r--r--mkspecs/features/qt_functions.prf14
2 files changed, 16 insertions, 1 deletions
diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf
index d70e5de..b1b00e43 100644
--- a/mkspecs/features/link_pkgconfig.prf
+++ b/mkspecs/features/link_pkgconfig.prf
@@ -1,5 +1,6 @@
# handle pkg-config files
-isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config
+isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config # keep consistent with qt_functions.prf too!
+
for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) {
QMAKE_CXXFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB)
QMAKE_CFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB)
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 964e13b..f1c3e13 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -103,3 +103,17 @@ defineTest(qtPrepareTool) {
}
export($$1)
}
+
+defineTest(packagesExist) {
+ # this can't be done in global scope here because qt_functions is loaded
+ # before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it
+ # yet. oops.
+ isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config # keep consistent with link_pkgconfig.prf! too
+
+ for(package, ARGS) {
+ !system($$PKG_CONFIG --exists $$package):return(false)
+ }
+
+ return(true)
+}
+