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>
This commit is contained in:
Christian Kandeler
2018-08-10 10:10:04 +02:00
parent c1a0d89732
commit 8cfd5b165a
6 changed files with 29 additions and 60 deletions

View File

@@ -5,6 +5,7 @@ QtcPlugin {
name: "ClangRefactoring"
Depends { name: "libclang"; required: false }
Depends { name: "clang_defines" }
condition: libclang.present && libclang.toolingEnabled
Depends { name: "ClangSupport" }
@@ -16,19 +17,7 @@ QtcPlugin {
Depends { name: "ProjectExplorer" }
Depends { name: "TextEditor" }
cpp.defines: {
var defines = base;
defines.push("CLANGPCHMANAGER_LIB");
// The following defines are used to determine the clang include path for intrinsics.
defines.push('CLANG_VERSION="' + libclang.llvmVersion + '"');
var resourceDir = FileInfo.joinPaths(libclang.llvmLibDir, "clang", libclang.llvmVersion,
"include");
defines.push('CLANG_RESOURCE_DIR="' + resourceDir + '"');
defines.push('CLANG_BINDIR="' + libclang.llvmBinDir + '"');
return defines;
}
cpp.defines: base.concat("CLANGPCHMANAGER_LIB")
cpp.includePaths: ["."]
files: [