aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-06-06 15:28:58 -0700
committerJake Petroules <jake.petroules@qt.io>2017-06-08 19:04:47 +0000
commit298e119ae4c4fe6c8687083b03a60a451600d482 (patch)
tree1b8643c79bfcd855c2e5cd68bebfc0f68262e6b3
parent3d418b5811fa813036bf44b9a5d96e82772d1ecb (diff)
Allow the GccProbe to fail more gracefully
This lets error handling be deferred to a more appropriate venue like module validate scripts rather than failing with an error message like "could not find/execute g++". Change-Id: I90223339a1b4ac4fa6674c8c2ddd95acc19d395e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/imports/qbs/Probes/GccProbe.qbs6
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs11
2 files changed, 17 insertions, 0 deletions
diff --git a/share/qbs/imports/qbs/Probes/GccProbe.qbs b/share/qbs/imports/qbs/Probes/GccProbe.qbs
index c08ab7d9a..7214ffacb 100644
--- a/share/qbs/imports/qbs/Probes/GccProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/GccProbe.qbs
@@ -29,6 +29,7 @@
****************************************************************************/
import qbs
+import qbs.File
import qbs.ModUtils
import "../../../modules/cpp/gcc.js" as Gcc
@@ -53,6 +54,11 @@ PathProbe {
property stringList frameworkPaths
configure: {
+ if (!File.exists(compilerFilePath)) {
+ found = false;
+ return;
+ }
+
var macros = Gcc.dumpMacros(environment, compilerFilePath, flags, _nullDevice);
var defaultPaths = Gcc.dumpDefaultPaths(environment, compilerFilePath, flags, _nullDevice,
_pathListSeparator, _sysroot);
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 5cad42578..d81fb15c8 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -242,6 +242,17 @@ CppModule {
}
validate: {
+ if (!File.exists(compilerPath)) {
+ var pathMessage = FileInfo.isAbsolutePath(compilerPath)
+ ? "at '" + compilerPath + "'"
+ : "'" + compilerPath + "' in PATH";
+ throw ModUtils.ModuleError("Could not find selected C++ compiler " + pathMessage + ". "
+ + "Ensure that the compiler is properly "
+ + "installed, or set cpp.toolchainInstallPath to a valid "
+ + "toolchain path, or consider whether you meant to set "
+ + "cpp.compilerName instead.");
+ }
+
var validator = new ModUtils.PropertyValidator("cpp");
validator.setRequiredProperty("architecture", architecture,
"you might want to re-run 'qbs-setup-toolchains'");