From 2ce03eae18e9432bffd612a33f2b8be46041f87c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 2 Mar 2020 11:19:47 +0100 Subject: [PATCH] QtSupport: Relax ABI matching when fixing a Qt kit E.g. consider MSVC 2019 a candidate when filling in the toolchain in a Qt kit that doesn't have one yet. Task-number: QTCREATORBUG-23653 Change-Id: I90aeb6f80c8f95faafa1e345f51fde77ddd0d2bd Reviewed-by: Kai Koehne --- src/plugins/qtsupport/qtkitinformation.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index 1e4037c4477..6c5a8b90cb4 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -222,13 +222,25 @@ void QtKitAspect::fix(ProjectExplorer::Kit *k) if (ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID)) return; const QString spec = version->mkspec(); - const QList possibleTcs = ToolChainManager::toolChains( + QList possibleTcs = ToolChainManager::toolChains( [version](const ToolChain *t) { return t->isValid() && t->language() == Core::Id(ProjectExplorer::Constants::CXX_LANGUAGE_ID) - && version->qtAbis().contains(t->targetAbi()); + && contains(version->qtAbis(), [t](const Abi &qtAbi) { + return qtAbi.isFullyCompatibleWith(t->targetAbi()); + }); }); if (!possibleTcs.isEmpty()) { + // Prefer exact matches. + // TODO: We should probably prefer the compiler with the highest version number instead, + // but this information is currently not exposed by the ToolChain class. + sort(possibleTcs, [version](const ToolChain *tc1, const ToolChain *tc2) { + const QVector &qtAbis = version->qtAbis(); + const bool tc1ExactMatch = qtAbis.contains(tc1->targetAbi()); + const bool tc2ExactMatch = qtAbis.contains(tc2->targetAbi()); + return tc1ExactMatch && !tc2ExactMatch; + }); + const QList goodTcs = Utils::filtered(possibleTcs, [&spec](const ToolChain *t) { return t->suggestedMkspecList().contains(spec);