summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/cmCMakePresetsFile.cxx17
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/Good.json.in5
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake2
3 files changed, 16 insertions, 8 deletions
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index dda366146e..16c2ed3d5b 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -184,8 +184,8 @@ auto const PresetVectorStringHelper =
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET,
PresetStringHelper);
-ReadFileResult PresetInheritsHelper(std::vector<std::string>& out,
- const Json::Value* value)
+ReadFileResult PresetVectorOneOrMoreStringHelper(std::vector<std::string>& out,
+ const Json::Value* value)
{
out.clear();
if (!value) {
@@ -312,8 +312,8 @@ auto const ConfigurePresetHelper =
cmJSONObjectHelper<ConfigurePreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
.Bind("name"_s, &ConfigurePreset::Name, PresetStringHelper)
- .Bind("inherits"_s, &ConfigurePreset::Inherits, PresetInheritsHelper,
- false)
+ .Bind("inherits"_s, &ConfigurePreset::Inherits,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("hidden"_s, &ConfigurePreset::Hidden, PresetBoolHelper, false)
.Bind<std::nullptr_t>("vendor"_s, nullptr,
VendorHelper(ReadFileResult::INVALID_PRESET), false)
@@ -340,7 +340,8 @@ auto const BuildPresetHelper =
cmJSONObjectHelper<BuildPreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
.Bind("name"_s, &BuildPreset::Name, PresetStringHelper)
- .Bind("inherits"_s, &BuildPreset::Inherits, PresetInheritsHelper, false)
+ .Bind("inherits"_s, &BuildPreset::Inherits,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("hidden"_s, &BuildPreset::Hidden, PresetBoolHelper, false)
.Bind<std::nullptr_t>("vendor"_s, nullptr,
VendorHelper(ReadFileResult::INVALID_PRESET), false)
@@ -356,7 +357,8 @@ auto const BuildPresetHelper =
&BuildPreset::InheritConfigureEnvironment, PresetOptionalBoolHelper,
false)
.Bind("jobs"_s, &BuildPreset::Jobs, PresetOptionalIntHelper, false)
- .Bind("targets"_s, &BuildPreset::Targets, PresetVectorStringHelper, false)
+ .Bind("targets"_s, &BuildPreset::Targets,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("configuration"_s, &BuildPreset::Configuration, PresetStringHelper,
false)
.Bind("cleanFirst"_s, &BuildPreset::CleanFirst, PresetOptionalBoolHelper,
@@ -657,7 +659,8 @@ auto const TestPresetHelper =
cmJSONObjectHelper<TestPreset, ReadFileResult>(
ReadFileResult::READ_OK, ReadFileResult::INVALID_PRESET, false)
.Bind("name"_s, &TestPreset::Name, PresetStringHelper)
- .Bind("inherits"_s, &TestPreset::Inherits, PresetInheritsHelper, false)
+ .Bind("inherits"_s, &TestPreset::Inherits,
+ PresetVectorOneOrMoreStringHelper, false)
.Bind("hidden"_s, &TestPreset::Hidden, PresetBoolHelper, false)
.Bind<std::nullptr_t>("vendor"_s, nullptr,
VendorHelper(ReadFileResult::INVALID_PRESET), false)
diff --git a/Tests/RunCMake/CMakePresetsBuild/Good.json.in b/Tests/RunCMake/CMakePresetsBuild/Good.json.in
index 8acd6f474a..c7f318ceda 100644
--- a/Tests/RunCMake/CMakePresetsBuild/Good.json.in
+++ b/Tests/RunCMake/CMakePresetsBuild/Good.json.in
@@ -73,6 +73,11 @@
"vendor": {
"example.com": "value"
}
+ },
+ {
+ "name": "singleTarget",
+ "inherits": "build-default",
+ "targets": "good"
}
]
}
diff --git a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
index f6ca6c5351..a05ad9ffd7 100644
--- a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
@@ -70,7 +70,7 @@ else()
set(Good_json_jobs [["jobs": 0,]])
endif()
-run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject")
+run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject;singleTarget")
run_cmake_build_presets(InvalidConfigurePreset "default" "badConfigurePreset")
set(CMakePresetsBuild_BUILD_ONLY 1)