ProjectExplorer: Do not ignore user-supplied mkspec

If the user explicitly sets the mkspec for a kit, we should remember
that, even if it happens to be the (current) default mkspec of the kit.

Fixes: QTCREATORBUG-16205
Change-Id: I9ee047bdaecce1aae7d0a8e4dfc2a0a25b6be744
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-05-02 09:58:21 +02:00
committed by hjk
parent 909dcaeee0
commit 1a78230c00
3 changed files with 8 additions and 5 deletions

View File

@@ -72,7 +72,8 @@ private:
void mkspecWasChanged(const QString &text)
{
m_ignoreChange = true;
QmakeKitAspect::setMkspec(m_kit, Utils::FileName::fromString(text));
QmakeKitAspect::setMkspec(m_kit, Utils::FileName::fromString(text),
QmakeKitAspect::MkspecSource::User);
m_ignoreChange = false;
}
@@ -191,10 +192,11 @@ FileName QmakeKitAspect::effectiveMkspec(const Kit *k)
return spec;
}
void QmakeKitAspect::setMkspec(Kit *k, const FileName &fn)
void QmakeKitAspect::setMkspec(Kit *k, const FileName &fn, MkspecSource source)
{
QTC_ASSERT(k, return);
k->setValue(QmakeKitAspect::id(), fn == defaultMkspec(k) ? QString() : fn.toString());
k->setValue(QmakeKitAspect::id(), source == MkspecSource::Code && fn == defaultMkspec(k)
? QString() : fn.toString());
}
FileName QmakeKitAspect::defaultMkspec(const Kit *k)

View File

@@ -47,7 +47,8 @@ public:
void addToMacroExpander(ProjectExplorer::Kit *kit, Utils::MacroExpander *expander) const override;
static Core::Id id();
static void setMkspec(ProjectExplorer::Kit *k, const Utils::FileName &fn);
enum class MkspecSource { User, Code };
static void setMkspec(ProjectExplorer::Kit *k, const Utils::FileName &fn, MkspecSource source);
static Utils::FileName mkspec(const ProjectExplorer::Kit *k);
static Utils::FileName effectiveMkspec(const ProjectExplorer::Kit *k);
static Utils::FileName defaultMkspec(const ProjectExplorer::Kit *k);

View File

@@ -302,7 +302,7 @@ Kit *QmakeProjectImporter::createTemporaryKit(const QtProjectImporter::QtVersion
for (ToolChain * const tc : preferredToolChains(data.qt, parsedSpec, archConfig))
ToolChainKitAspect::setToolChain(k, tc);
if (parsedSpec != data.qt->mkspec())
QmakeKitAspect::setMkspec(k, parsedSpec);
QmakeKitAspect::setMkspec(k, parsedSpec, QmakeKitAspect::MkspecSource::Code);
});
}