Fix toolchain detection when C compiler specified

If someone specifies C compiler instead of C++ one, then
extractToolchainPrefix() returns an empty result which
causes invalid behaiour on build stage.

Task-number: QTCREATORBUG-14250
Change-Id: I94d2a281c6a98178c486019344c6cdc71ac50a49
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Sergey Belyashov
2015-04-16 00:24:06 +03:00
committed by Tobias Hunger
parent 171d16c6fb
commit bcbf0d8417

View File

@@ -62,7 +62,9 @@ static QString extractToolchainPrefix(QString *compilerName)
{ {
QString prefix; QString prefix;
if (compilerName->endsWith(QLatin1String("-g++")) if (compilerName->endsWith(QLatin1String("-g++"))
|| compilerName->endsWith(QLatin1String("-clang++"))) { || compilerName->endsWith(QLatin1String("-clang++"))
|| compilerName->endsWith(QLatin1String("-gcc"))
|| compilerName->endsWith(QLatin1String("-clang"))) {
const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1; const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1;
prefix = compilerName->left(idx); prefix = compilerName->left(idx);
compilerName->remove(0, idx); compilerName->remove(0, idx);