summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorSankhesh Jhaveri <sankhesh.jhaveri@kitware.com>2022-07-21 13:50:25 (GMT)
committerBrad King <brad.king@kitware.com>2022-08-03 14:20:04 (GMT)
commit47929ee98c44d84d9e86e23cc93093f857e11780 (patch)
treead5d32a956df67ba902d18220663e7ddecd2df48 /Source/cmake.cxx
parent2be09731e0a441b5303344a91c2ba162e9fdf031 (diff)
downloadCMake-47929ee98c44d84d9e86e23cc93093f857e11780.zip
CMake-47929ee98c44d84d9e86e23cc93093f857e11780.tar.gz
CMake-47929ee98c44d84d9e86e23cc93093f857e11780.tar.bz2
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 e6fa219..d5aae86 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;
}