QbsProjectManager: Fix handling of cross-compilers on Windows.

Task-number: QTCREATORBUG-15011
Change-Id: Iea84e1a545bc6f414a35602e1d0c8c903901e813
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Christian Kandeler
2015-09-03 12:36:13 +02:00
parent 396c033707
commit d58002dd46

View File

@@ -62,13 +62,16 @@ using namespace WinRt::Internal::Constants;
static QString extractToolchainPrefix(QString *compilerName) static QString extractToolchainPrefix(QString *compilerName)
{ {
QString prefix; QString prefix;
if (compilerName->endsWith(QLatin1String("-g++")) const QStringList candidates = { QLatin1String("g++"), QLatin1String("clang++"),
|| compilerName->endsWith(QLatin1String("-clang++")) QLatin1String("gcc"), QLatin1String("clang") };
|| compilerName->endsWith(QLatin1String("-gcc")) foreach (const QString &candidate, candidates) {
|| compilerName->endsWith(QLatin1String("-clang"))) { const QString suffix = Utils::HostOsInfo::withExecutableSuffix(QLatin1Char('-')
const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1; + candidate);
prefix = compilerName->left(idx); if (compilerName->endsWith(suffix)) {
compilerName->remove(0, idx); const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1;
prefix = compilerName->left(idx);
compilerName->remove(0, idx);
}
} }
return prefix; return prefix;
} }