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>
This commit is contained in:
Jake Petroules
2016-11-10 23:20:44 -08:00
committed by Eike Ziller
parent b892d82086
commit e50c9afce9

View File

@@ -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) {