cmcmd: Improve error message from cmake_symlink_{library,executable}
parent
7f89053953
commit
79a2f1e22a
|
@ -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);
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cmsys/Status.hxx"
|
||||
|
||||
#include "cmCryptoHash.h"
|
||||
|
||||
class cmConsoleBuf;
|
||||
|
@ -28,8 +30,8 @@ protected:
|
|||
cmCryptoHash::Algo algo);
|
||||
static int SymlinkLibrary(std::vector<std::string> const& args);
|
||||
static int SymlinkExecutable(std::vector<std::string> const& args);
|
||||
static bool SymlinkInternal(std::string const& file,
|
||||
std::string const& link);
|
||||
static cmsys::Status SymlinkInternal(std::string const& file,
|
||||
std::string const& link);
|
||||
static int ExecuteEchoColor(std::vector<std::string> const& args);
|
||||
static int ExecuteLinkScript(std::vector<std::string> const& args);
|
||||
static int WindowsCEEnvironment(const char* version,
|
||||
|
|
Loading…
Reference in New Issue