diff options
author | Martin Duffy <martin.duffy@kitware.com> | 2023-03-22 17:11:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-29 14:41:19 (GMT) |
commit | 19305afd8a2a46925b1a880de68f7be0ad1f3091 (patch) | |
tree | cdef4417cd852c2a5dd85886df4ff61d7fd2e653 /Source/cmake.cxx | |
parent | 6b08358e17f5b85ad04ab512e4b6e39e989cea35 (diff) | |
download | CMake-19305afd8a2a46925b1a880de68f7be0ad1f3091.zip CMake-19305afd8a2a46925b1a880de68f7be0ad1f3091.tar.gz CMake-19305afd8a2a46925b1a880de68f7be0ad1f3091.tar.bz2 |
presets: Improve JSON parser and error messages
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index dbf961d..db47e43 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -52,6 +52,7 @@ #if !defined(CMAKE_BOOTSTRAP) # include "cmMakefileProfilingData.h" #endif +#include "cmJSONState.h" #include "cmMessenger.h" #include "cmState.h" #include "cmStateDirectory.h" @@ -1411,13 +1412,10 @@ void cmake::SetArgs(const std::vector<std::string>& args) if (listPresets != ListPresets::None || !presetName.empty()) { cmCMakePresetsGraph presetsGraph; auto result = presetsGraph.ReadProjectPresets(this->GetHomeDirectory()); - if (result != cmCMakePresetsGraph::ReadFileResult::READ_OK) { + if (result != true) { std::string errorMsg = - cmStrCat("Could not read presets from ", this->GetHomeDirectory(), - ": ", cmCMakePresetsGraph::ResultToString(result)); - if (!presetsGraph.errors.empty()) { - errorMsg = cmStrCat(errorMsg, "\nErrors:\n", presetsGraph.errors); - } + cmStrCat("Could not read presets from ", this->GetHomeDirectory(), ":", + presetsGraph.parseState.GetErrorMessage()); cmSystemTools::Error(errorMsg); return; } @@ -3426,10 +3424,10 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets, cmCMakePresetsGraph settingsFile; auto result = settingsFile.ReadProjectPresets(this->GetHomeDirectory()); - if (result != cmCMakePresetsGraph::ReadFileResult::READ_OK) { + if (result != true) { cmSystemTools::Error( - cmStrCat("Could not read presets from ", this->GetHomeDirectory(), - ": ", cmCMakePresetsGraph::ResultToString(result))); + cmStrCat("Could not read presets from ", this->GetHomeDirectory(), ":", + settingsFile.parseState.GetErrorMessage())); return 1; } @@ -3782,10 +3780,10 @@ int cmake::Workflow(const std::string& presetName, cmCMakePresetsGraph settingsFile; auto result = settingsFile.ReadProjectPresets(this->GetHomeDirectory()); - if (result != cmCMakePresetsGraph::ReadFileResult::READ_OK) { - cmSystemTools::Error( - cmStrCat("Could not read presets from ", this->GetHomeDirectory(), ": ", - cmCMakePresetsGraph::ResultToString(result))); + if (result != true) { + cmSystemTools::Error(cmStrCat("Could not read presets from ", + this->GetHomeDirectory(), ":", + settingsFile.parseState.GetErrorMessage())); return 1; } |