summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-15 16:39:57 (GMT)
committerBrad King <brad.king@kitware.com>2021-04-15 16:40:37 (GMT)
commit79a2f1e22a4ff95d7d96478d579a7f52b3c289da (patch)
tree664981235332ac590cafa4d3ff5518893f40fdd0 /Source/cmcmd.cxx
parent7f89053953f81aaa3d0283ba4b8d8b29ce234292 (diff)
downloadCMake-79a2f1e22a4ff95d7d96478d579a7f52b3c289da.zip
CMake-79a2f1e22a4ff95d7d96478d579a7f52b3c289da.tar.gz
CMake-79a2f1e22a4ff95d7d96478d579a7f52b3c289da.tar.bz2
cmcmd: Improve error message from cmake_symlink_{library,executable}
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index a47eccd..928435e 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1601,14 +1601,18 @@ int cmcmd::SymlinkLibrary(std::vector<std::string> const& args)
cmSystemTools::ConvertToUnixSlashes(soName);
cmSystemTools::ConvertToUnixSlashes(name);
if (soName != realName) {
- if (!cmcmd::SymlinkInternal(realName, soName)) {
- cmSystemTools::ReportLastSystemError("cmake_symlink_library");
+ cmsys::Status status = cmcmd::SymlinkInternal(realName, soName);
+ if (!status) {
+ cmSystemTools::Error(
+ cmStrCat("cmake_symlink_library: System Error: ", status.GetString()));
result = 1;
}
}
if (name != soName) {
- if (!cmcmd::SymlinkInternal(soName, name)) {
- cmSystemTools::ReportLastSystemError("cmake_symlink_library");
+ cmsys::Status status = cmcmd::SymlinkInternal(soName, name);
+ if (!status) {
+ cmSystemTools::Error(
+ cmStrCat("cmake_symlink_library: System Error: ", status.GetString()));
result = 1;
}
}
@@ -1621,21 +1625,24 @@ int cmcmd::SymlinkExecutable(std::vector<std::string> const& args)
std::string const& realName = args[2];
std::string const& name = args[3];
if (name != realName) {
- if (!cmcmd::SymlinkInternal(realName, name)) {
- cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
+ cmsys::Status status = cmcmd::SymlinkInternal(realName, name);
+ if (!status) {
+ cmSystemTools::Error(cmStrCat("cmake_symlink_executable: System Error: ",
+ status.GetString()));
result = 1;
}
}
return result;
}
-bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
+cmsys::Status cmcmd::SymlinkInternal(std::string const& file,
+ std::string const& link)
{
if (cmSystemTools::FileExists(link) || cmSystemTools::FileIsSymlink(link)) {
cmSystemTools::RemoveFile(link);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
- return static_cast<bool>(cmSystemTools::CopyFileAlways(file, link));
+ return cmSystemTools::CopyFileAlways(file, link);
#else
std::string linktext = cmSystemTools::GetFilenameName(file);
return cmSystemTools::CreateSymlink(linktext, link);