diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-06-26 17:04:30 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-06-29 08:36:50 +0000 |
commit | 8112ca60323e8342627bffe92ca8f00bfc5812cc (patch) | |
tree | 56fe93817b6657cd866d782ac4ddb3c541b1665a /share/qbs/modules/cpp/GenericGCC.qbs | |
parent | db351f78a672cc9ecf50eae01385675348cd1920 (diff) |
Move the compiler version detection into a separate Probe
The compiler version is needed in the GccProbe itself (to determine
which compiler flags are available to use) so it cannot be done in a
single probe. This change will be taken advantage of in a subsequent
patch.
This patch also fixes a silent failure that caused the wrong compiler
flags to be used in the GccProbe due to the compiler version being
undefined at the point where feature checks based on the compiler
version were being made... specifically, that the -target flag was
assumed to be unavailable due to the missing compiler version.
Change-Id: I13626c37f3fd21b5b8b6632714ba9dd9373b7838
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/GenericGCC.qbs')
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index c9e10d081..228efee26 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -49,6 +49,15 @@ CppModule { names: [compilerName] } + // Find the version as early as possible in case other things depend on it, + // for example the question of whether certain flags are supported and which need to be used + // in the GccProbe itself. + Probes.GccVersionProbe { + id: gccVersionProbe + compilerFilePath: compilerPath + environment: buildEnv + } + Probes.GccProbe { id: gccProbe compilerFilePath: compilerPath @@ -88,9 +97,9 @@ CppModule { qbs.architecture: gccProbe.found ? gccProbe.architecture : original - compilerVersionMajor: gccProbe.versionMajor - compilerVersionMinor: gccProbe.versionMinor - compilerVersionPatch: gccProbe.versionPatch + compilerVersionMajor: gccVersionProbe.versionMajor + compilerVersionMinor: gccVersionProbe.versionMinor + compilerVersionPatch: gccVersionProbe.versionPatch compilerIncludePaths: gccProbe.includePaths compilerFrameworkPaths: gccProbe.frameworkPaths @@ -100,7 +109,9 @@ CppModule { && Utilities.versionCompare(compilerVersion, "3.1") >= 0 property bool assemblerHasTargetOption: qbs.toolchain.contains("xcode") && Utilities.versionCompare(compilerVersion, "7") >= 0 - property string target: [targetArch, targetVendor, targetSystem, targetAbi].join("-") + property string target: targetArch + ? [targetArch, targetVendor, targetSystem, targetAbi].join("-") + : undefined property string targetArch: Utilities.canonicalTargetArchitecture( qbs.architecture, targetVendor, targetSystem, targetAbi) property string targetVendor: "unknown" |