ProjectExplorer: Fix spurious GCC execution on start-up

The mingw and gcc factories share some file name candidates.
Make sure we don't test a known gcc executable again for mingw (and vice
versa).

Change-Id: Iddbf1a0c435f6515ff07fca695cb55211faab28e
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2022-01-18 13:48:08 +01:00
parent 31807ab917
commit 57666c2a49

View File

@@ -1112,18 +1112,8 @@ Toolchains GccToolChainFactory::autoDetectToolchains(
{
const FilePaths compilerPaths =
findCompilerCandidates(detector.device, compilerName, detectVariants == DetectVariants::Yes);
Toolchains existingCandidates
= filtered(detector.alreadyKnown, [requiredTypeId, language, &checker](const ToolChain *tc) {
if (tc->typeId() != requiredTypeId)
return false;
if (tc->language() != language)
return false;
if (checker && !checker(tc))
return false;
return true;
});
Toolchains existingCandidates = filtered(detector.alreadyKnown,
[language](const ToolChain *tc) { return tc->language() == language; });
Toolchains result;
for (const FilePath &compilerPath : qAsConst(compilerPaths)) {
bool alreadyExists = false;
@@ -1148,8 +1138,10 @@ Toolchains GccToolChainFactory::autoDetectToolchains(
== compilerPath.toFileInfo().size());
}
if (existingTcMatches) {
if (!result.contains(existingTc))
if (existingTc->typeId() == requiredTypeId && (!checker || checker(existingTc))
&& !result.contains(existingTc)) {
result << existingTc;
}
alreadyExists = true;
}
}