diff options
author | Robin Burchell <robin.burchell@collabora.co.uk> | 2011-01-17 12:31:44 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-01-17 12:31:44 (GMT) |
commit | a13e97b42c89159667f2d89c7eda2dbfdf1465e8 (patch) | |
tree | 69156ba854317007a63436f2bc26fb9252756479 /mkspecs/features/qt_functions.prf | |
parent | 32f3fcd9ab19f66cb435e6a8830ce54ccf13885a (diff) | |
download | Qt-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/qt_functions.prf')
-rw-r--r-- | mkspecs/features/qt_functions.prf | 14 |
1 files changed, 14 insertions, 0 deletions
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) +} + |