summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-03-01 17:51:07 (GMT)
committerBrad King <brad.king@kitware.com>2008-03-01 17:51:07 (GMT)
commit34c76d4304064d7d0e28ceaeee8ba4048497215a (patch)
tree1fe059dba6b66836c39b0e2b2c0d622a78b5c981 /Source/cmFileCommand.cxx
parent61178a0682a024e03e6fe41897b40bb096611f7a (diff)
downloadCMake-34c76d4304064d7d0e28ceaeee8ba4048497215a.zip
CMake-34c76d4304064d7d0e28ceaeee8ba4048497215a.tar.gz
CMake-34c76d4304064d7d0e28ceaeee8ba4048497215a.tar.bz2
ENH: Use builtin chrpath instead of relinking ELF targets
- Add cmSystemTools::ChangeRPath method - Add undocumented file(CHRPATH) command - When installing use file(CHRPATH) to change the rpath instead of relinking - Remove CMAKE_CHRPATH lookup from CMakeFindBinUtils - Remove CMAKE_USE_CHRPATH option since this should always work
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index ec61a59..0128135 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -112,6 +112,10 @@ bool cmFileCommand
{
return this->HandleInstallCommand(args);
}
+ else if ( subCommand == "CHRPATH" )
+ {
+ return this->HandleChrpathCommand(args);
+ }
else if ( subCommand == "RELATIVE_PATH" )
{
return this->HandleRelativePathCommand(args);
@@ -1327,6 +1331,34 @@ bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer,
}
//----------------------------------------------------------------------------
+bool cmFileCommand::HandleChrpathCommand(std::vector<std::string> const& args)
+{
+ if(args.size() != 3)
+ {
+ this->SetError("CHRPATH must be given a file and a new rpath.");
+ return false;
+ }
+ if(!cmSystemTools::FileExists(args[1].c_str(), true))
+ {
+ this->SetError("CHRPATH given file that does not exist.");
+ return false;
+ }
+ std::string emsg;
+ if(cmSystemTools::ChangeRPath(args[1], args[2], &emsg))
+ {
+ return true;
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "CHRPATH could not write new RPATH to the file: "
+ << emsg;
+ this->SetError(e.str().c_str());
+ return false;
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
{
if ( args.size() < 6 )