ENH: Pass config to cmTarget RPATH install methods

This passes the build configuration to cmTarget methods IsChrpathUsed
and NeedRelinkBeforeInstall.  Later these methods will use the value.
This commit is contained in:
Brad King 2009-07-08 13:03:47 -04:00
parent 6ef56f7778
commit a3a046643a
8 changed files with 18 additions and 16 deletions

View File

@ -315,7 +315,7 @@ cmComputeLinkInformation
this->RuntimeAlways =
(this->Makefile->
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
this->RuntimeUseChrpath = this->Target->IsChrpathUsed();
this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config);
// Get options needed to help find dependent libraries.
std::string rlVar = "CMAKE_";

View File

@ -451,7 +451,8 @@ cmGlobalUnixMakefileGenerator3
{
// Add this to the list of depends rules in this directory.
if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink || l->second.NeedRelinkBeforeInstall()))
(!check_relink ||
l->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
{
std::string tname = lg->GetRelativeTargetDirectory(l->second);
tname += "/";
@ -659,7 +660,7 @@ cmGlobalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
if(t->second.NeedRelinkBeforeInstall())
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
makeTargetName = lg->GetRelativeTargetDirectory(t->second);
makeTargetName += "/preinstall";
@ -829,7 +830,7 @@ cmGlobalUnixMakefileGenerator3
t->second.GetName(), depends, commands, true);
// Add rules to prepare the target for installation.
if(t->second.NeedRelinkBeforeInstall())
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
localName = lg->GetRelativeTargetDirectory(t->second);
localName += "/preinstall";

View File

@ -69,7 +69,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
{
// Compute the build tree directory from which to copy the target.
std::string fromDirConfig;
if(this->Target->NeedRelinkBeforeInstall())
if(this->Target->NeedRelinkBeforeInstall(config))
{
fromDirConfig = this->Target->GetMakefile()->GetStartOutputDirectory();
fromDirConfig += cmake::GetCMakeFilesDirectory();
@ -529,7 +529,7 @@ cmInstallTargetGenerator
const char* config, std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->IsChrpathUsed())
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
{
return;
}
@ -560,7 +560,7 @@ cmInstallTargetGenerator
const char* config, std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->IsChrpathUsed())
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
{
return;
}

View File

@ -372,7 +372,7 @@ void cmLocalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
if(t->second.NeedRelinkBeforeInstall())
if(t->second.NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
{
makeTargetName = this->GetRelativeTargetDirectory(t->second);
makeTargetName += "/preinstall";

View File

@ -60,7 +60,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
// write the link rules
this->WriteExecutableRule(false);
if(this->Target->NeedRelinkBeforeInstall())
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName))
{
// Write rules to link an installable version of the target.
this->WriteExecutableRule(true);

View File

@ -72,7 +72,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break;
case cmTarget::SHARED_LIBRARY:
this->WriteSharedLibraryRules(false);
if(this->Target->NeedRelinkBeforeInstall())
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName))
{
// Write rules to link an installable version of the target.
this->WriteSharedLibraryRules(true);
@ -80,7 +80,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break;
case cmTarget::MODULE_LIBRARY:
this->WriteModuleLibraryRules(false);
if(this->Target->NeedRelinkBeforeInstall())
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName))
{
// Write rules to link an installable version of the target.
this->WriteModuleLibraryRules(true);

View File

@ -3025,7 +3025,7 @@ bool cmTarget::HaveInstallTreeRPATH()
}
//----------------------------------------------------------------------------
bool cmTarget::NeedRelinkBeforeInstall()
bool cmTarget::NeedRelinkBeforeInstall(const char* config)
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
@ -3056,7 +3056,7 @@ bool cmTarget::NeedRelinkBeforeInstall()
}
// If chrpath is going to be used no relinking is needed.
if(this->IsChrpathUsed())
if(this->IsChrpathUsed(config))
{
return false;
}
@ -3349,7 +3349,7 @@ void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
}
//----------------------------------------------------------------------------
bool cmTarget::IsChrpathUsed()
bool cmTarget::IsChrpathUsed(const char* config)
{
#if defined(CMAKE_USE_ELF_PARSER)
// Only certain target types have an rpath.
@ -3405,6 +3405,7 @@ bool cmTarget::IsChrpathUsed()
}
}
#endif
static_cast<void>(config);
return false;
}

View File

@ -353,13 +353,13 @@ public:
/**
* Compute whether this target must be relinked before installing.
*/
bool NeedRelinkBeforeInstall();
bool NeedRelinkBeforeInstall(const char* config);
bool HaveBuildTreeRPATH();
bool HaveInstallTreeRPATH();
/** Return true if builtin chrpath will work for this target */
bool IsChrpathUsed();
bool IsChrpathUsed(const char* config);
std::string GetInstallNameDirForBuildTree(const char* config,
bool for_xcode = false);