diff options
author | Brad King <brad.king@kitware.com> | 2008-01-29 15:07:33 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-29 15:07:33 -0500 |
commit | ffac622a858cca4dc661caa896d961da666430cc (patch) | |
tree | 3c52af43de45021dbfc5afc7f64f3ce17701a78f /Source/cmInstallTargetGenerator.cxx | |
parent | bb52f45ebb6b1c80f8f7b8e2b841202118ed9d06 (diff) | |
download | cmake-ffac622a858cca4dc661caa896d961da666430cc.tar.gz |
ENH: Add cmTarget::GetLinkInformation method to allow several places in the generators to share link information while only computing it once per configuration for a target. Use it to simplify the chrpath feature.
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 2cbb31ef81..4f6539a716 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -16,6 +16,7 @@ =========================================================================*/ #include "cmInstallTargetGenerator.h" +#include "cmComputeLinkInformation.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" @@ -283,7 +284,7 @@ cmInstallTargetGenerator os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n"; this->AddInstallNamePatchRule(os, indent.Next(), config, toDestDirPath); - this->AddChrpathPatchRule(os, indent.Next(), toDestDirPath); + this->AddChrpathPatchRule(os, indent.Next(), config, toDestDirPath); this->AddRanlibRule(os, indent.Next(), type, toDestDirPath); this->AddStripRule(os, indent.Next(), type, toDestDirPath); os << indent << "ENDIF(EXISTS \"" << toDestDirPath << "\")\n"; @@ -487,7 +488,7 @@ cmInstallTargetGenerator void cmInstallTargetGenerator ::AddChrpathPatchRule(std::ostream& os, Indent const& indent, - std::string const& toDestDirPath) + const char* config, std::string const& toDestDirPath) { if(this->ImportLibrary || !(this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -497,40 +498,24 @@ cmInstallTargetGenerator return; } - if((this->Target->GetMakefile()->IsOn("CMAKE_USE_CHRPATH")==false) - || (this->Target->IsChrpathAvailable()==false)) + if(!this->Target->IsChrpathUsed()) { return; } - // Fix the RPATH in installed ELF binaries using chrpath. - std::string chrpathTool = - this->Target->GetMakefile()->GetSafeDefinition("CMAKE_CHRPATH"); - - std::string installRpath; - std::string dummy; - this->Target->GetMakefile()->GetLocalGenerator()->GetLinkerArgs( - installRpath, dummy, *this->Target, true, 0); - - const char* linkLanguage = this->Target->GetLinkerLanguage(this->Target-> - GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()); - if (linkLanguage==0) + // Get the link information for this target. + // It can provide the RPATH. + cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + if(!cli) { return; } - std::string runTimeFlagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; - runTimeFlagVar += linkLanguage; - runTimeFlagVar += "_FLAG"; - - std::string runtimeFlag = - this->Target->GetMakefile()->GetSafeDefinition(runTimeFlagVar.c_str()); + // Get the install RPATH from the link information. + std::string newRpath = cli->GetChrpathString(); - const char* newRpath=installRpath.c_str(); - if (strstr(installRpath.c_str(), runtimeFlag.c_str())==installRpath.c_str()) - { - newRpath = installRpath.c_str()+strlen(runtimeFlag.c_str()); - } + // Fix the RPATH in installed ELF binaries using chrpath. + std::string chrpathTool = cli->GetChrpathTool(); // Write a rule to run chrpath to set the install-tree RPATH os << indent << "EXECUTE_PROCESS(COMMAND \"" << chrpathTool; |