summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-03-10 19:59:14 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-22 19:04:54 (GMT)
commit8bc5c8961e552a15091b7f4d2c205ce90b8f764f (patch)
treeac9fe9a92c01accd1fee2c4914347369546f85ff /Source/cmake.cxx
parentce6ea7c927b9f80f219a7783ce725bea4c24091f (diff)
downloadCMake-8bc5c8961e552a15091b7f4d2c205ce90b8f764f.zip
CMake-8bc5c8961e552a15091b7f4d2c205ce90b8f764f.tar.gz
CMake-8bc5c8961e552a15091b7f4d2c205ce90b8f764f.tar.bz2
CMakePresets.json: Add the ability to conditionally disable presets
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index b12eeee..61ce154 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1217,6 +1217,11 @@ void cmake::SetArgs(const std::vector<std::string>& args)
"\": Invalid macro expansion"));
return;
}
+ if (!expandedPreset->ConditionResult) {
+ cmSystemTools::Error(cmStrCat("Could not use disabled preset \"",
+ preset->second.Unexpanded.Name, "\""));
+ return;
+ }
if (!this->State->IsCacheLoaded() && !haveBArg) {
this->SetHomeOutputDirectory(expandedPreset->BinaryDir);
@@ -3164,6 +3169,14 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
return 1;
}
+ if (!expandedPreset->ConditionResult) {
+ cmSystemTools::Error(cmStrCat("Cannot use disabled build preset in ",
+ this->GetHomeDirectory(), ": \"",
+ presetName, '"'));
+ settingsFile.PrintBuildPresetList();
+ return 1;
+ }
+
auto configurePresetPair =
settingsFile.ConfigurePresets.find(expandedPreset->ConfigurePreset);
if (configurePresetPair == settingsFile.ConfigurePresets.end()) {