ENH: Inform user when RPATH or RUNPATH is removed
This commit is contained in:
parent
485c3faea7
commit
8063dd293e
|
@ -1486,7 +1486,8 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
|
|||
cmSystemToolsFileTime* ft = cmSystemTools::FileTimeNew();
|
||||
bool have_ft = cmSystemTools::FileTimeGet(file, ft);
|
||||
std::string emsg;
|
||||
if(!cmSystemTools::RemoveRPath(file, &emsg))
|
||||
bool removed;
|
||||
if(!cmSystemTools::RemoveRPath(file, &emsg, &removed))
|
||||
{
|
||||
cmOStringStream e;
|
||||
e << "RPATH_REMOVE could not remove RPATH from file:\n"
|
||||
|
@ -1495,10 +1496,20 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
|
|||
this->SetError(e.str().c_str());
|
||||
success = false;
|
||||
}
|
||||
if(success && have_ft)
|
||||
if(success)
|
||||
{
|
||||
if(removed)
|
||||
{
|
||||
std::string message = "Removed runtime path from \"";
|
||||
message += file;
|
||||
message += "\"";
|
||||
this->Makefile->DisplayStatus(message.c_str(), -1);
|
||||
}
|
||||
if(have_ft)
|
||||
{
|
||||
cmSystemTools::FileTimeSet(file, ft);
|
||||
}
|
||||
}
|
||||
cmSystemTools::FileTimeDelete(ft);
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -2525,9 +2525,14 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg)
|
||||
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
|
||||
bool* removed)
|
||||
{
|
||||
#if defined(CMAKE_USE_ELF_PARSER)
|
||||
if(removed)
|
||||
{
|
||||
*removed = false;
|
||||
}
|
||||
int zeroCount = 0;
|
||||
unsigned long zeroPosition[2] = {0,0};
|
||||
unsigned long zeroSize[2] = {0,0};
|
||||
|
@ -2676,10 +2681,15 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg)
|
|||
}
|
||||
|
||||
// Everything was updated successfully.
|
||||
if(removed)
|
||||
{
|
||||
*removed = true;
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
(void)file;
|
||||
(void)emsg;
|
||||
(void)removed;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -396,7 +396,8 @@ public:
|
|||
bool* changed = 0);
|
||||
|
||||
/** Try to remove the RPATH from an ELF binary. */
|
||||
static bool RemoveRPath(std::string const& file, std::string* emsg = 0);
|
||||
static bool RemoveRPath(std::string const& file, std::string* emsg = 0,
|
||||
bool* removed = 0);
|
||||
|
||||
/** Check whether the RPATH in an ELF binary contains the path
|
||||
given. */
|
||||
|
|
Loading…
Reference in New Issue