aboutsummaryrefslogtreecommitdiffstats
path: root/qbs/modules
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-10 10:10:04 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-10 09:57:38 +0000
commit8cfd5b165a77279961d5c744f560e9f050c86390 (patch)
treee8d41174d8b1b96db5481192cc08f096bea9c6d8 /qbs/modules
parentc1a0d897327af3e63ab00e7b0f5a9101991ed713 (diff)
Fix qbs build when no llvm is present
Some defines were set conditionally, but accessed unconditionally, which of course breaks the build. Make sure the defines are always set. Also gather them in a module, instead of copying the code all over the place. Change-Id: Iac628da64fb3934872d912510936aeccd0e20247 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'qbs/modules')
-rw-r--r--qbs/modules/clang_defines/clang_defines.qbs18
1 files changed, 18 insertions, 0 deletions
diff --git a/qbs/modules/clang_defines/clang_defines.qbs b/qbs/modules/clang_defines/clang_defines.qbs
new file mode 100644
index 0000000000..361941c2c9
--- /dev/null
+++ b/qbs/modules/clang_defines/clang_defines.qbs
@@ -0,0 +1,18 @@
+import qbs
+import qbs.FileInfo
+
+Module {
+ Depends { name: "cpp" }
+ Depends { name: "libclang"; required: false }
+
+ cpp.defines: libclang.present ? [
+ 'CLANG_VERSION="' + libclang.llvmVersion + '"',
+ 'CLANG_RESOURCE_DIR="' + FileInfo.joinPaths(libclang.llvmLibDir, "clang",
+ libclang.llvmVersion, "include") + '"',
+ 'CLANG_BINDIR="' + libclang.llvmBinDir + '"',
+ ] : [
+ 'CLANG_VERSION=""',
+ 'CLANG_RESOURCE_DIR=""',
+ 'CLANG_BINDIR=""',
+ ]
+}