diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-12-18 22:50:27 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-12-18 22:50:27 (GMT) |
commit | 3ae731fab7a3b992c321226262076a2622f64c11 (patch) | |
tree | 223da7b100533710445dde2a52243baff0883452 /Source/cmLocalGenerator.cxx | |
parent | f5f397debde141a15225ea52bc2768d723a27375 (diff) | |
download | CMake-3ae731fab7a3b992c321226262076a2622f64c11.zip CMake-3ae731fab7a3b992c321226262076a2622f64c11.tar.gz CMake-3ae731fab7a3b992c321226262076a2622f64c11.tar.bz2 |
ENH: add support for chrpath, so the RPATH in ELF files can be changed when
installing without having to link the target again -> can save a lot of time
chrpath is handled very similar to install_name_tool on the mac. If the
RPATH in the build tree file is to short, it is padded using the separator
character.
This is currently disabled by default, it can be enabled using the option
CMAKE_USE_CHRPATH. There are additional checks whether it is safe to enable
it. I will rework them and use FILE(READ) instead to detect whether the
binaries are actually ELF files.
chrpath is available here
http://www.tux.org/pub/X-Windows/ftp.hungry.com/chrpath/
or kde svn (since a few days): http://websvn.kde.org/trunk/kdesupport/chrpath/
Alex
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6c081b9..bf91751 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1479,7 +1479,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, bool cmLocalGenerator::GetLinkerArgs(std::string& rpath, std::string& linkLibs, cmTarget& tgt, - bool relink) + bool relink, + int minRpathSize) { rpath = ""; // collect all the flags needed for linking libraries @@ -1656,6 +1657,18 @@ bool cmLocalGenerator::GetLinkerArgs(std::string& rpath, } } } + + if (rpath.size()<minRpathSize) + { + if (rpath.size()==0) + { + rpath += runtimeFlag; + } + while (rpath.size() < minRpathSize) + { + rpath += runtimeSep; + } + } return true; } @@ -1670,7 +1683,19 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, { std::string rpath; std::string linkLibs; - if (!this->GetLinkerArgs(rpath, linkLibs, tgt, relink)) + int minBuildRpathSize = 0; + + if ((relink==false) + && this->Makefile->IsOn("CMAKE_USE_CHRPATH") + && (tgt.IsChrpathAvailable())) + { + std::string installRpath; + std::string dummy; + this->GetLinkerArgs(installRpath, dummy, tgt, true, 0); + minBuildRpathSize=installRpath.size(); + } + + if (!this->GetLinkerArgs(rpath, linkLibs, tgt, relink, minBuildRpathSize)) { return; } |