Fix restoring cmake run configurations

Amends 5bcd59c94f.

Fixes: QTCREATORBUG-22932
Change-Id: I46b42f0e15eaf1fe4bd2f1ea4a87286ee68cfee8
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-10-17 13:02:43 +02:00
parent bfc65cee98
commit 139196b93c
2 changed files with 10 additions and 2 deletions

View File

@@ -356,9 +356,14 @@ bool RunConfiguration::fromMap(const QVariantMap &map)
m_buildKey = map.value(BUILD_KEY).toString();
if (m_buildKey.isEmpty()) {
// FIXME: Remove this id mangling, e.g. by using a separate entry for the build key.
const Core::Id mangledId = Core::Id::fromSetting(map.value(settingsIdKey()));
m_buildKey = mangledId.suffixAfter(id());
// Hack for cmake projects 4.10 -> 4.11.
const QString magicSeparator = "///::///";
const int magicIndex = m_buildKey.indexOf(magicSeparator);
if (magicIndex != -1)
m_buildKey = m_buildKey.mid(magicIndex + magicSeparator.length());
}
return true;

View File

@@ -867,7 +867,10 @@ bool Target::fromMap(const QVariantMap &map)
RunConfiguration *rc = RunConfigurationFactory::restore(this, valueMap);
if (!rc)
continue;
QTC_CHECK(rc->id().withSuffix(rc->buildKey()) == ProjectExplorer::idFromMap(valueMap));
const Core::Id theIdFromMap = ProjectExplorer::idFromMap(valueMap);
if (!theIdFromMap.toString().contains("///::///")) { // Hack for cmake 4.10 -> 4.11
QTC_CHECK(rc->id().withSuffix(rc->buildKey()) == theIdFromMap);
}
addRunConfiguration(rc);
if (i == activeConfiguration)
setActiveRunConfiguration(rc);