From d88fefb8851040282633e12bb0a35760a864c0a1 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 30 Jul 2018 14:42:43 +0200 Subject: 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 --- share/qbs/modules/cpp/GenericGCC.qbs | 5 ++--- .../api/testdata/build-properties-source/build-properties-source.qbs | 5 +++++ 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" ] -- cgit v1.2.3