diff options
author | Brad King <brad.king@kitware.com> | 2022-10-06 17:44:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-06 18:38:53 (GMT) |
commit | aba48bd6acbf564dcb5b831b26cc01743b5b5f71 (patch) | |
tree | 9b0d1e44f351ee52509095fb801509e630f5814f /Source/cmFileCommand.cxx | |
parent | 2133cf2c8e575bfff000041505208e28bcdfd4a3 (diff) | |
download | CMake-aba48bd6acbf564dcb5b831b26cc01743b5b5f71.zip CMake-aba48bd6acbf564dcb5b831b26cc01743b5b5f71.tar.gz CMake-aba48bd6acbf564dcb5b831b26cc01743b5b5f71.tar.bz2 |
cmSystemTools: Provide quiet link creation methods
Offer variants that let the caller handle error messages.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index bec9fb2..421ff12 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2960,11 +2960,23 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args, // Check if the command requires a symbolic link. if (arguments.Symbolic) { - completed = static_cast<bool>( - cmSystemTools::CreateSymlink(fileName, newFileName, &result)); + cmsys::Status linked = + cmSystemTools::CreateSymlinkQuietly(fileName, newFileName); + if (linked) { + completed = true; + } else { + result = cmStrCat("failed to create symbolic link '", newFileName, + "': ", linked.GetString()); + } } else { - completed = static_cast<bool>( - cmSystemTools::CreateLink(fileName, newFileName, &result)); + cmsys::Status linked = + cmSystemTools::CreateLinkQuietly(fileName, newFileName); + if (linked) { + completed = true; + } else { + result = cmStrCat("failed to create link '", newFileName, + "': ", linked.GetString()); + } } // Check if copy-on-error is enabled in the arguments. |