diff options
author | Terence Noone <me@techtricity.net> | 2022-12-08 00:48:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-12-08 12:54:55 (GMT) |
commit | efae1ab68badef66505363505aecce7a7c3dbe6a (patch) | |
tree | a4f6f16a522711121165408a6270dc05c68dd1b7 /Source/cmFileCommand.cxx | |
parent | 127fa54808acd80b658409758533c2522f6a1c19 (diff) | |
download | CMake-efae1ab68badef66505363505aecce7a7c3dbe6a.zip CMake-efae1ab68badef66505363505aecce7a7c3dbe6a.tar.gz CMake-efae1ab68badef66505363505aecce7a7c3dbe6a.tar.bz2 |
file(MAKE_DIRECTORY): Provide a more descriptive error message
Previously, MAKE_DIRECTORY would print `problem creating directory: {}`,
which was very unhelpful for debugging. Extend the message with the
OS error string.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index cdd0408..dfce033 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -845,8 +845,10 @@ bool HandleMakeDirectoryCommand(std::vector<std::string> const& args, cmSystemTools::SetFatalErrorOccurred(); return false; } - if (!cmSystemTools::MakeDirectory(*cdir)) { - std::string error = "problem creating directory: " + *cdir; + cmsys::Status mkdirStatus = cmSystemTools::MakeDirectory(*cdir); + if (!mkdirStatus) { + std::string error = cmStrCat("failed to create directory:\n ", *cdir, + "\nbecause: ", mkdirStatus.GetString()); status.SetError(error); return false; } |