summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx39
1 files changed, 12 insertions, 27 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 2cbb31e..4f6539a 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;