diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-11-10 23:20:44 -0800 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2016-11-14 12:02:06 +0000 |
commit | e50c9afce996d5fdc6298819ba289d0e63d4342c (patch) | |
tree | 23e5d3bb2e2434b653b7e0b30ef8caa32fe9f80f /src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp | |
parent | b892d82086132f12c0aa432376b696d9616b6cca (diff) | |
download | qt-creator-e50c9afce996d5fdc6298819ba289d0e63d4342c.tar.gz |
Qbs: filter out -arch compiler flags from platformCompiler/LinkerFlags
-arch is not allowed in compiler flags as it's automatically handled by
the qbs.architecture property, and is an error in current versions of
Qbs. If the architecture was successfully detected, remove the flags.
Change-Id: I85cce7b7f4ef5a92f857ec624a912861bcb267f5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp')
-rw-r--r-- | src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp index 0d8796e926..ba24c94fb9 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp @@ -171,6 +171,20 @@ static MSVCVersion msvcCompilerVersion(const ProjectExplorer::Abi &abi) return v; } +static void filterCompilerLinkerFlags(const ProjectExplorer::Abi &targetAbi, QStringList &flags) +{ + for (int i = 0; i < flags.size(); ) { + if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture + && flags[i] == QStringLiteral("-arch") + && i + 1 < flags.size()) { + flags.removeAt(i); + flags.removeAt(i); + } else { + ++i; + } + } +} + QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const { @@ -234,8 +248,13 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath()); if (ProjectExplorer::GccToolChain *gcc = dynamic_cast<ProjectExplorer::GccToolChain *>(tc)) { - data.insert(QLatin1String(CPP_PLATFORMCOMMONCOMPILERFLAGS), gcc->platformCodeGenFlags()); - data.insert(QLatin1String(CPP_PLATFORMLINKERFLAGS), gcc->platformLinkerFlags()); + QStringList compilerFlags = gcc->platformCodeGenFlags(); + filterCompilerLinkerFlags(targetAbi, compilerFlags); + data.insert(QLatin1String(CPP_PLATFORMCOMMONCOMPILERFLAGS), compilerFlags); + + QStringList linkerFlags = gcc->platformLinkerFlags(); + filterCompilerLinkerFlags(targetAbi, linkerFlags); + data.insert(QLatin1String(CPP_PLATFORMLINKERFLAGS), linkerFlags); } if (targetAbi.os() == ProjectExplorer::Abi::MacOS) { |