aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-07-30 14:42:43 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-02 08:40:22 +0000
commitd88fefb8851040282633e12bb0a35760a864c0a1 (patch)
tree7e70715c65cdec8b577df5b14d12a30489924551
parent5dc6209478e070b885acc317dccf5c561ad61ecb (diff)
GCC: Allow the -march option to be set in project files
It is unrealistic to cover all its possible uses via dedicated properties. Task-number: QBS-1018 Change-Id: Iacfb9617ef130255c35766f057c60be9f816bca2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs5
-rw-r--r--tests/auto/api/testdata/build-properties-source/build-properties-source.qbs5
2 files changed, 7 insertions, 3 deletions
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 792e8ef4c..4e68dc267 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -343,8 +343,7 @@ CppModule {
var validateFlagsFunction = function (value) {
if (value) {
for (var i = 0; i < value.length; ++i) {
- if (["-target", "-triple", "-arch"].contains(value[i])
- || value[i].startsWith("-march="))
+ if (["-target", "-triple", "-arch"].contains(value[i]))
return false;
}
}
@@ -352,7 +351,7 @@ CppModule {
}
var validator = new ModUtils.PropertyValidator("cpp");
- var msg = "'-target', '-triple', '-arch' and '-march' cannot appear in flags; set qbs.architecture instead";
+ var msg = "'-target', '-triple' and '-arch' cannot appear in flags; set qbs.architecture instead";
validator.addCustomValidator("assemblerFlags", assemblerFlags, validateFlagsFunction, msg);
validator.addCustomValidator("cppFlags", cppFlags, validateFlagsFunction, msg);
validator.addCustomValidator("cFlags", cFlags, validateFlagsFunction, msg);
diff --git a/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs b/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs
index 49f565b29..485bca79d 100644
--- a/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs
+++ b/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs
@@ -8,6 +8,11 @@ Project {
Depends { name: 'cpp' }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ cpp.cxxFlags: "-march=native"
+ }
+
Group {
cpp.defines: ['WORLD="BANANA"']
files : [ "main.cpp" ]