mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
Merge topic 'cmake-presets-v2-inherit-v3-optional' into release-3.21
3e42bf3e05 CMakePresets: Check presets with their own file version
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6398
This commit is contained in:
@@ -78,7 +78,8 @@ void InheritVector(std::vector<T>& child, const std::vector<T>& parent)
|
||||
template <class T>
|
||||
ReadFileResult VisitPreset(
|
||||
T& preset, std::map<std::string, cmCMakePresetsFile::PresetPair<T>>& presets,
|
||||
std::map<std::string, CycleStatus> cycleStatus, int version)
|
||||
std::map<std::string, CycleStatus> cycleStatus,
|
||||
const cmCMakePresetsFile& file)
|
||||
{
|
||||
switch (cycleStatus[preset.Name]) {
|
||||
case CycleStatus::InProgress:
|
||||
@@ -108,7 +109,7 @@ ReadFileResult VisitPreset(
|
||||
return ReadFileResult::USER_PRESET_INHERITANCE;
|
||||
}
|
||||
|
||||
auto result = VisitPreset(parentPreset, presets, cycleStatus, version);
|
||||
auto result = VisitPreset(parentPreset, presets, cycleStatus, file);
|
||||
if (result != ReadFileResult::READ_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -128,7 +129,7 @@ ReadFileResult VisitPreset(
|
||||
preset.ConditionEvaluator.reset();
|
||||
}
|
||||
|
||||
CHECK_OK(preset.VisitPresetAfterInherit(version))
|
||||
CHECK_OK(preset.VisitPresetAfterInherit(file.GetVersion(preset)))
|
||||
|
||||
cycleStatus[preset.Name] = CycleStatus::Verified;
|
||||
return ReadFileResult::READ_OK;
|
||||
@@ -146,8 +147,7 @@ ReadFileResult ComputePresetInheritance(
|
||||
|
||||
for (auto& it : presets) {
|
||||
auto& preset = it.second.Unexpanded;
|
||||
auto result =
|
||||
VisitPreset<T>(preset, presets, cycleStatus, file.GetVersion(preset));
|
||||
auto result = VisitPreset<T>(preset, presets, cycleStatus, file);
|
||||
if (result != ReadFileResult::READ_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -260,6 +260,7 @@ unset(CMakePresets_FILE)
|
||||
run_cmake_presets(GoodUserOnly)
|
||||
run_cmake_presets(GoodUserFromMain)
|
||||
run_cmake_presets(GoodUserFromUser)
|
||||
run_cmake_presets(V2InheritV3Optional)
|
||||
|
||||
# Test CMakeUserPresets.json errors
|
||||
run_cmake_presets(UserDuplicateInUser)
|
||||
|
||||
8
Tests/RunCMake/CMakePresets/V2InheritV3Optional.json.in
Normal file
8
Tests/RunCMake/CMakePresets/V2InheritV3Optional.json.in
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
Tests/RunCMake/CMakePresets/V2InheritV3OptionalUser.json.in
Normal file
11
Tests/RunCMake/CMakePresets/V2InheritV3OptionalUser.json.in
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "V2InheritV3Optional",
|
||||
"inherits": "default",
|
||||
"generator": "@RunCMake_GENERATOR@",
|
||||
"binaryDir": "${sourceDir}/build"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user