Skip to content
Snippets Groups Projects
Commit e50c9afc authored by Jake Petroules's avatar Jake Petroules Committed by Eike Ziller
Browse files

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: default avatarEike Ziller <eike.ziller@qt.io>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@qt.io>
parent b892d820
No related branches found
No related tags found
No related merge requests found
...@@ -171,6 +171,20 @@ static MSVCVersion msvcCompilerVersion(const ProjectExplorer::Abi &abi) ...@@ -171,6 +171,20 @@ static MSVCVersion msvcCompilerVersion(const ProjectExplorer::Abi &abi)
return v; 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, QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplorer::Kit *k,
const QVariantMap &defaultData) const const QVariantMap &defaultData) const
{ {
...@@ -234,8 +248,13 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor ...@@ -234,8 +248,13 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath()); data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath());
if (ProjectExplorer::GccToolChain *gcc = dynamic_cast<ProjectExplorer::GccToolChain *>(tc)) { if (ProjectExplorer::GccToolChain *gcc = dynamic_cast<ProjectExplorer::GccToolChain *>(tc)) {
data.insert(QLatin1String(CPP_PLATFORMCOMMONCOMPILERFLAGS), gcc->platformCodeGenFlags()); QStringList compilerFlags = gcc->platformCodeGenFlags();
data.insert(QLatin1String(CPP_PLATFORMLINKERFLAGS), gcc->platformLinkerFlags()); 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) { if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment