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();
|
cmSystemToolsFileTime* ft = cmSystemTools::FileTimeNew();
|
||||||
bool have_ft = cmSystemTools::FileTimeGet(file, ft);
|
bool have_ft = cmSystemTools::FileTimeGet(file, ft);
|
||||||
std::string emsg;
|
std::string emsg;
|
||||||
if(!cmSystemTools::RemoveRPath(file, &emsg))
|
bool removed;
|
||||||
|
if(!cmSystemTools::RemoveRPath(file, &emsg, &removed))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "RPATH_REMOVE could not remove RPATH from file:\n"
|
e << "RPATH_REMOVE could not remove RPATH from file:\n"
|
||||||
|
@ -1495,9 +1496,19 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args)
|
||||||
this->SetError(e.str().c_str());
|
this->SetError(e.str().c_str());
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if(success && have_ft)
|
if(success)
|
||||||
{
|
{
|
||||||
cmSystemTools::FileTimeSet(file, ft);
|
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);
|
cmSystemTools::FileTimeDelete(ft);
|
||||||
return success;
|
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 defined(CMAKE_USE_ELF_PARSER)
|
||||||
|
if(removed)
|
||||||
|
{
|
||||||
|
*removed = false;
|
||||||
|
}
|
||||||
int zeroCount = 0;
|
int zeroCount = 0;
|
||||||
unsigned long zeroPosition[2] = {0,0};
|
unsigned long zeroPosition[2] = {0,0};
|
||||||
unsigned long zeroSize[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.
|
// Everything was updated successfully.
|
||||||
|
if(removed)
|
||||||
|
{
|
||||||
|
*removed = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
(void)file;
|
(void)file;
|
||||||
(void)emsg;
|
(void)emsg;
|
||||||
|
(void)removed;
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,8 @@ public:
|
||||||
bool* changed = 0);
|
bool* changed = 0);
|
||||||
|
|
||||||
/** Try to remove the RPATH from an ELF binary. */
|
/** 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
|
/** Check whether the RPATH in an ELF binary contains the path
|
||||||
given. */
|
given. */
|
||||||
|
|
Loading…
Reference in New Issue