QbsProjectManager: Fix cross-compiling with clang

In order to use a generic clang as a cross-compiler, we have to pass "-
target" in the "platform codegen flags" in the toolchain settings.
However, qbs errors out when that flag is used directly, so we need to
filter it out along with "-arch".

Change-Id: Ide83115b046bc53c330e86b5d5715640a4c5ed98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2024-12-09 13:14:48 +01:00
parent 8fedcb6ba9
commit c1db4f6acc

View File

@@ -233,8 +233,7 @@ static void filterCompilerLinkerFlags(const ProjectExplorer::Abi &targetAbi, QSt
{
for (int i = 0; i < flags.size(); ) {
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture
&& flags[i] == QStringLiteral("-arch")
&& i + 1 < flags.size()) {
&& (flags[i] == "-arch" || flags[i] == "-target") && i + 1 < flags.size()) {
flags.removeAt(i);
flags.removeAt(i);
} else {