summaryrefslogtreecommitdiff
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorSankhesh Jhaveri <sankhesh.jhaveri@kitware.com>2022-07-21 09:50:25 -0400
committerBrad King <brad.king@kitware.com>2022-08-03 10:20:04 -0400
commit47929ee98c44d84d9e86e23cc93093f857e11780 (patch)
treead5d32a956df67ba902d18220663e7ddecd2df48 /Source/cmake.cxx
parent2be09731e0a441b5303344a91c2ba162e9fdf031 (diff)
downloadcmake-47929ee98c44d84d9e86e23cc93093f857e11780.tar.gz
presets: Add basic error forwarding from cmake preset json parser
Print errors only if there are errors. Add filename for better introspection, particularly for FileNotFound errors with presets.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e6fa21995a..d5aae86564 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1286,9 +1286,13 @@ void cmake::SetArgs(const std::vector<std::string>& args)
cmCMakePresetsGraph presetsGraph;
auto result = presetsGraph.ReadProjectPresets(this->GetHomeDirectory());
if (result != cmCMakePresetsGraph::ReadFileResult::READ_OK) {
- cmSystemTools::Error(
+ std::string errorMsg =
cmStrCat("Could not read presets from ", this->GetHomeDirectory(),
- ": ", cmCMakePresetsGraph::ResultToString(result)));
+ ": ", cmCMakePresetsGraph::ResultToString(result));
+ if (!presetsGraph.errors.empty()) {
+ errorMsg = cmStrCat(errorMsg, "\nErrors:\n", presetsGraph.errors);
+ }
+ cmSystemTools::Error(errorMsg);
return;
}