diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-02-02 16:30:56 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-02-02 20:17:30 (GMT) |
commit | c18409cdac4d9a8213201eaec53b3cc2d60c68e3 (patch) | |
tree | 27cf6445a79d9d8cb99a08209c6de2844e93f91c /Source/cmCMakePresetsGraph.cxx | |
parent | 92459258108c0036808f29f83a8503fea18ccee9 (diff) | |
download | CMake-c18409cdac4d9a8213201eaec53b3cc2d60c68e3.zip CMake-c18409cdac4d9a8213201eaec53b3cc2d60c68e3.tar.gz CMake-c18409cdac4d9a8213201eaec53b3cc2d60c68e3.tar.bz2 |
CMakePresets.json: Ensure configurePreset is reachable from current file
Diffstat (limited to 'Source/cmCMakePresetsGraph.cxx')
-rw-r--r-- | Source/cmCMakePresetsGraph.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 79e8191..705e2b0 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -108,7 +108,7 @@ ReadFileResult VisitPreset( auto& parentPreset = parent->second.Unexpanded; if (!preset.OriginFile->ReachableFiles.count(parentPreset.OriginFile)) { - return ReadFileResult::PRESET_UNREACHABLE_FROM_FILE; + return ReadFileResult::INHERITED_PRESET_UNREACHABLE_FROM_FILE; } auto result = VisitPreset(parentPreset, presets, cycleStatus, graph); @@ -925,6 +925,10 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) if (configurePreset == this->ConfigurePresets.end()) { return ReadFileResult::INVALID_CONFIGURE_PRESET; } + if (!it.second.Unexpanded.OriginFile->ReachableFiles.count( + configurePreset->second.Unexpanded.OriginFile)) { + return ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE; + } if (it.second.Unexpanded.InheritConfigureEnvironment.value_or(true)) { it.second.Unexpanded.Environment.insert( @@ -945,6 +949,10 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) if (configurePreset == this->ConfigurePresets.end()) { return ReadFileResult::INVALID_CONFIGURE_PRESET; } + if (!it.second.Unexpanded.OriginFile->ReachableFiles.count( + configurePreset->second.Unexpanded.OriginFile)) { + return ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE; + } if (it.second.Unexpanded.InheritConfigureEnvironment.value_or(true)) { it.second.Unexpanded.Environment.insert( @@ -992,8 +1000,10 @@ const char* cmCMakePresetsGraph::ResultToString(ReadFileResult result) return "Duplicate presets"; case ReadFileResult::CYCLIC_PRESET_INHERITANCE: return "Cyclic preset inheritance"; - case ReadFileResult::PRESET_UNREACHABLE_FROM_FILE: + case ReadFileResult::INHERITED_PRESET_UNREACHABLE_FROM_FILE: return "Inherited preset is unreachable from preset's file"; + case ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE: + return "Configure preset is unreachable from preset's file"; case ReadFileResult::INVALID_MACRO_EXPANSION: return "Invalid macro expansion"; case ReadFileResult::BUILD_TEST_PRESETS_UNSUPPORTED: |