forked from qt-creator/qt-creator
QmakePM: Fix false positive warning for incompatible compiler
Some users set 'QMAKE_CXX = @echo $< && $$QMAKE_CXX' to prettify the compiler output. Another useful case for "incompatible" compiler is ccache, or other compiler wrappers. To eliminate warnings for these cases, pick the last value of QMAKE_CC/ QMAKE_CXX, excluding flags, and compare it against the configured toolchain. Change-Id: Idc3b9377e6f7c39c09c50f36ec89460756510b97 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
a8f1f758a5
commit
ffabc5dff1
@@ -1532,8 +1532,17 @@ bool QmakeProject::matchesKit(const Kit *kit)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Utils::FileName getFullPathOf(const QString &exe, const BuildConfiguration *bc)
|
static Utils::FileName getFullPathOf(const QmakeProFileNode *pro, QmakeVariable variable,
|
||||||
|
const BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
|
// Take last non-flag value, to cover e.g. '@echo $< && $$QMAKE_CC' or 'ccache gcc'
|
||||||
|
const QStringList values = Utils::filtered(pro->variableValue(variable),
|
||||||
|
[](const QString &value) {
|
||||||
|
return !value.startsWith('-');
|
||||||
|
});
|
||||||
|
if (values.isEmpty())
|
||||||
|
return Utils::FileName();
|
||||||
|
const QString exe = values.last();
|
||||||
QTC_ASSERT(bc, return Utils::FileName::fromString(exe));
|
QTC_ASSERT(bc, return Utils::FileName::fromString(exe));
|
||||||
QFileInfo fi(exe);
|
QFileInfo fi(exe);
|
||||||
if (fi.isAbsolute())
|
if (fi.isAbsolute())
|
||||||
@@ -1572,9 +1581,9 @@ void QmakeProject::warnOnToolChainMismatch(const QmakeProFileNode *pro) const
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
testToolChain(ToolChainKitInformation::toolChain(t->kit(), ToolChain::Language::C),
|
testToolChain(ToolChainKitInformation::toolChain(t->kit(), ToolChain::Language::C),
|
||||||
getFullPathOf(pro->singleVariableValue(QmakeCc), bc));
|
getFullPathOf(pro, QmakeCc, bc));
|
||||||
testToolChain(ToolChainKitInformation::toolChain(t->kit(), ToolChain::Language::Cxx),
|
testToolChain(ToolChainKitInformation::toolChain(t->kit(), ToolChain::Language::Cxx),
|
||||||
getFullPathOf(pro->singleVariableValue(QmakeCxx), bc));
|
getFullPathOf(pro, QmakeCxx, bc));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmakeProject::executableFor(const QmakeProFileNode *node)
|
QString QmakeProject::executableFor(const QmakeProFileNode *node)
|
||||||
|
Reference in New Issue
Block a user