diff options
author | Brad King <brad.king@kitware.com> | 2022-02-03 12:32:48 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-02-03 12:32:54 (GMT) |
commit | 0c0d4e1c7a26fccd873a1053772d7989e18a871a (patch) | |
tree | 60eac2f8ace5b42389a090b3c98db895b6a85ac2 /Source | |
parent | fb2658165303c29163e1d4f81a10df3dd427097c (diff) | |
parent | c18409cdac4d9a8213201eaec53b3cc2d60c68e3 (diff) | |
download | CMake-0c0d4e1c7a26fccd873a1053772d7989e18a871a.zip CMake-0c0d4e1c7a26fccd873a1053772d7989e18a871a.tar.gz CMake-0c0d4e1c7a26fccd873a1053772d7989e18a871a.tar.bz2 |
Merge topic 'cmake-presets-configure-preset-reachability'
c18409cdac CMakePresets.json: Ensure configurePreset is reachable from current file
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6937
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCMakePresetsGraph.cxx | 14 | ||||
-rw-r--r-- | Source/cmCMakePresetsGraph.h | 3 |
2 files changed, 14 insertions, 3 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: diff --git a/Source/cmCMakePresetsGraph.h b/Source/cmCMakePresetsGraph.h index d3a5cfc..9d6c61a 100644 --- a/Source/cmCMakePresetsGraph.h +++ b/Source/cmCMakePresetsGraph.h @@ -35,7 +35,8 @@ public: INVALID_VARIABLE, DUPLICATE_PRESETS, CYCLIC_PRESET_INHERITANCE, - PRESET_UNREACHABLE_FROM_FILE, + INHERITED_PRESET_UNREACHABLE_FROM_FILE, + CONFIGURE_PRESET_UNREACHABLE_FROM_FILE, INVALID_MACRO_EXPANSION, BUILD_TEST_PRESETS_UNSUPPORTED, INCLUDE_UNSUPPORTED, |