From 8063dd293e6f9c25dcfa964989138d4f5bb135ac Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Aug 2008 09:53:26 -0400 Subject: ENH: Inform user when RPATH or RUNPATH is removed --- Source/cmFileCommand.cxx | 17 ++++++++++++++--- Source/cmSystemTools.cxx | 12 +++++++++++- Source/cmSystemTools.h | 3 ++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6ac6bcca..e8e64a4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1486,7 +1486,8 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector 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,9 +1496,19 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector const& args) this->SetError(e.str().c_str()); 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); return success; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ba85034..f333a4c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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 } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 493ff71..1ff12bf 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -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. */ -- cgit v0.12