mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
cmcmd: Improve error message from cmake_symlink_{library,executable}
This commit is contained in:
@@ -1601,14 +1601,18 @@ int cmcmd::SymlinkLibrary(std::vector<std::string> const& args)
|
|||||||
cmSystemTools::ConvertToUnixSlashes(soName);
|
cmSystemTools::ConvertToUnixSlashes(soName);
|
||||||
cmSystemTools::ConvertToUnixSlashes(name);
|
cmSystemTools::ConvertToUnixSlashes(name);
|
||||||
if (soName != realName) {
|
if (soName != realName) {
|
||||||
if (!cmcmd::SymlinkInternal(realName, soName)) {
|
cmsys::Status status = cmcmd::SymlinkInternal(realName, soName);
|
||||||
cmSystemTools::ReportLastSystemError("cmake_symlink_library");
|
if (!status) {
|
||||||
|
cmSystemTools::Error(
|
||||||
|
cmStrCat("cmake_symlink_library: System Error: ", status.GetString()));
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name != soName) {
|
if (name != soName) {
|
||||||
if (!cmcmd::SymlinkInternal(soName, name)) {
|
cmsys::Status status = cmcmd::SymlinkInternal(soName, name);
|
||||||
cmSystemTools::ReportLastSystemError("cmake_symlink_library");
|
if (!status) {
|
||||||
|
cmSystemTools::Error(
|
||||||
|
cmStrCat("cmake_symlink_library: System Error: ", status.GetString()));
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1621,21 +1625,24 @@ int cmcmd::SymlinkExecutable(std::vector<std::string> const& args)
|
|||||||
std::string const& realName = args[2];
|
std::string const& realName = args[2];
|
||||||
std::string const& name = args[3];
|
std::string const& name = args[3];
|
||||||
if (name != realName) {
|
if (name != realName) {
|
||||||
if (!cmcmd::SymlinkInternal(realName, name)) {
|
cmsys::Status status = cmcmd::SymlinkInternal(realName, name);
|
||||||
cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
|
if (!status) {
|
||||||
|
cmSystemTools::Error(cmStrCat("cmake_symlink_executable: System Error: ",
|
||||||
|
status.GetString()));
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
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)) {
|
if (cmSystemTools::FileExists(link) || cmSystemTools::FileIsSymlink(link)) {
|
||||||
cmSystemTools::RemoveFile(link);
|
cmSystemTools::RemoveFile(link);
|
||||||
}
|
}
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
return static_cast<bool>(cmSystemTools::CopyFileAlways(file, link));
|
return cmSystemTools::CopyFileAlways(file, link);
|
||||||
#else
|
#else
|
||||||
std::string linktext = cmSystemTools::GetFilenameName(file);
|
std::string linktext = cmSystemTools::GetFilenameName(file);
|
||||||
return cmSystemTools::CreateSymlink(linktext, link);
|
return cmSystemTools::CreateSymlink(linktext, link);
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "cmsys/Status.hxx"
|
||||||
|
|
||||||
#include "cmCryptoHash.h"
|
#include "cmCryptoHash.h"
|
||||||
|
|
||||||
class cmConsoleBuf;
|
class cmConsoleBuf;
|
||||||
@@ -28,8 +30,8 @@ protected:
|
|||||||
cmCryptoHash::Algo algo);
|
cmCryptoHash::Algo algo);
|
||||||
static int SymlinkLibrary(std::vector<std::string> const& args);
|
static int SymlinkLibrary(std::vector<std::string> const& args);
|
||||||
static int SymlinkExecutable(std::vector<std::string> const& args);
|
static int SymlinkExecutable(std::vector<std::string> const& args);
|
||||||
static bool SymlinkInternal(std::string const& file,
|
static cmsys::Status SymlinkInternal(std::string const& file,
|
||||||
std::string const& link);
|
std::string const& link);
|
||||||
static int ExecuteEchoColor(std::vector<std::string> const& args);
|
static int ExecuteEchoColor(std::vector<std::string> const& args);
|
||||||
static int ExecuteLinkScript(std::vector<std::string> const& args);
|
static int ExecuteLinkScript(std::vector<std::string> const& args);
|
||||||
static int WindowsCEEnvironment(const char* version,
|
static int WindowsCEEnvironment(const char* version,
|
||||||
|
Reference in New Issue
Block a user