presets: Identify unreachable inherited presets

This commit is contained in:
Maximilian Sander
2026-07-28 00:57:52 +02:00
parent 0779279585
commit e928b9327a
4 changed files with 8 additions and 4 deletions
+5 -2
View File
@@ -123,11 +123,14 @@ void CYCLIC_PRESET_INHERITANCE(std::string const& presetName,
}
void INHERITED_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
std::string const& inheritedPreset,
std::string const& kind,
cmJSONState* state)
{
state->AddError(cmStrCat("Inherited ", kind, " preset \"", presetName,
"\" is unreachable from preset's file"));
state->AddError(cmStrCat(CapitalizePresetKind(kind), " preset \"",
presetName, "\" inherits preset \"",
inheritedPreset, "\", but \"", inheritedPreset,
"\" is not reachable from the preset's file"));
}
void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
+1
View File
@@ -47,6 +47,7 @@ void CYCLIC_PRESET_INHERITANCE(std::string const& presetName,
std::string const& kind, cmJSONState* state);
void INHERITED_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName,
std::string const& inheritedPreset,
std::string const& kind,
cmJSONState* state);
+1 -1
View File
@@ -146,7 +146,7 @@ bool VisitPreset(
auto& parentPreset = parent->second.Unexpanded;
if (!preset.OriginFile->ReachableFiles.count(parentPreset.OriginFile)) {
cmCMakePresetsErrors::INHERITED_PRESET_UNREACHABLE_FROM_FILE(
preset.Name, preset.kind(), &graph.parseState);
preset.Name, i, preset.kind(), &graph.parseState);
return false;
}
@@ -1,3 +1,3 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/UserInheritance:
Inherited configure preset "UserInheritance" is unreachable from preset's file$
Configure preset "UserInheritance" inherits preset "UserInheritanceUser", but "UserInheritanceUser" is not reachable from the preset's file$