From d58002dd4674ed5632714482c9639a2d259007db Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 3 Sep 2015 12:36:13 +0200 Subject: [PATCH] QbsProjectManager: Fix handling of cross-compilers on Windows. Task-number: QTCREATORBUG-15011 Change-Id: Iea84e1a545bc6f414a35602e1d0c8c903901e813 Reviewed-by: Joerg Bornemann --- .../defaultpropertyprovider.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp index f3e6badb4d8..6c04eb8dd90 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp @@ -62,13 +62,16 @@ using namespace WinRt::Internal::Constants; static QString extractToolchainPrefix(QString *compilerName) { QString prefix; - if (compilerName->endsWith(QLatin1String("-g++")) - || compilerName->endsWith(QLatin1String("-clang++")) - || compilerName->endsWith(QLatin1String("-gcc")) - || compilerName->endsWith(QLatin1String("-clang"))) { - const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1; - prefix = compilerName->left(idx); - compilerName->remove(0, idx); + const QStringList candidates = { QLatin1String("g++"), QLatin1String("clang++"), + QLatin1String("gcc"), QLatin1String("clang") }; + foreach (const QString &candidate, candidates) { + const QString suffix = Utils::HostOsInfo::withExecutableSuffix(QLatin1Char('-') + + candidate); + if (compilerName->endsWith(suffix)) { + const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1; + prefix = compilerName->left(idx); + compilerName->remove(0, idx); + } } return prefix; }