forked from qt-creator/qt-creator
CMakePM: Allow presets inherits for deeper hierarchies
Fixes: QTCREATORBUG-28498 Change-Id: Idea5cdec6ad6acfba289dd77632770b7dfbf64f2 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -96,14 +96,24 @@ Internal::PresetsData CMakeProject::combinePresets(Internal::PresetsData &cmakeP
|
|||||||
for (const auto &p : presets)
|
for (const auto &p : presets)
|
||||||
presetsHash.insert(p.name, p);
|
presetsHash.insert(p.name, p);
|
||||||
|
|
||||||
auto resolveInherits = [](const auto &presetsHash, auto &presetsList) {
|
auto resolveInherits = [](auto &presetsHash, auto &presetsList) {
|
||||||
|
Utils::sort(presetsList, [](const auto &left, const auto &right) {
|
||||||
|
if (left.inherits) {
|
||||||
|
if (left.inherits.value().contains(right.name))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
for (auto &p : presetsList) {
|
for (auto &p : presetsList) {
|
||||||
if (!p.inherits)
|
if (!p.inherits)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (const QString &inheritFromName : p.inherits.value())
|
for (const QString &inheritFromName : p.inherits.value()) {
|
||||||
if (presetsHash.contains(inheritFromName))
|
if (presetsHash.contains(inheritFromName)) {
|
||||||
p.inheritFrom(presetsHash[inheritFromName]);
|
p.inheritFrom(presetsHash[inheritFromName]);
|
||||||
|
presetsHash[p.name] = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user