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:
parent
6ef56f7778
commit
a3a046643a
@ -315,7 +315,7 @@ cmComputeLinkInformation
|
|||||||
this->RuntimeAlways =
|
this->RuntimeAlways =
|
||||||
(this->Makefile->
|
(this->Makefile->
|
||||||
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
|
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.
|
// Get options needed to help find dependent libraries.
|
||||||
std::string rlVar = "CMAKE_";
|
std::string rlVar = "CMAKE_";
|
||||||
|
@ -451,7 +451,8 @@ cmGlobalUnixMakefileGenerator3
|
|||||||
{
|
{
|
||||||
// Add this to the list of depends rules in this directory.
|
// Add this to the list of depends rules in this directory.
|
||||||
if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
|
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);
|
std::string tname = lg->GetRelativeTargetDirectory(l->second);
|
||||||
tname += "/";
|
tname += "/";
|
||||||
@ -659,7 +660,7 @@ cmGlobalUnixMakefileGenerator3
|
|||||||
|
|
||||||
// Add a local name for the rule to relink the target before
|
// Add a local name for the rule to relink the target before
|
||||||
// installation.
|
// installation.
|
||||||
if(t->second.NeedRelinkBeforeInstall())
|
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
|
||||||
{
|
{
|
||||||
makeTargetName = lg->GetRelativeTargetDirectory(t->second);
|
makeTargetName = lg->GetRelativeTargetDirectory(t->second);
|
||||||
makeTargetName += "/preinstall";
|
makeTargetName += "/preinstall";
|
||||||
@ -829,7 +830,7 @@ cmGlobalUnixMakefileGenerator3
|
|||||||
t->second.GetName(), depends, commands, true);
|
t->second.GetName(), depends, commands, true);
|
||||||
|
|
||||||
// Add rules to prepare the target for installation.
|
// 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 = lg->GetRelativeTargetDirectory(t->second);
|
||||||
localName += "/preinstall";
|
localName += "/preinstall";
|
||||||
|
@ -69,7 +69,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||||||
{
|
{
|
||||||
// Compute the build tree directory from which to copy the target.
|
// Compute the build tree directory from which to copy the target.
|
||||||
std::string fromDirConfig;
|
std::string fromDirConfig;
|
||||||
if(this->Target->NeedRelinkBeforeInstall())
|
if(this->Target->NeedRelinkBeforeInstall(config))
|
||||||
{
|
{
|
||||||
fromDirConfig = this->Target->GetMakefile()->GetStartOutputDirectory();
|
fromDirConfig = this->Target->GetMakefile()->GetStartOutputDirectory();
|
||||||
fromDirConfig += cmake::GetCMakeFilesDirectory();
|
fromDirConfig += cmake::GetCMakeFilesDirectory();
|
||||||
@ -529,7 +529,7 @@ cmInstallTargetGenerator
|
|||||||
const char* config, std::string const& toDestDirPath)
|
const char* config, std::string const& toDestDirPath)
|
||||||
{
|
{
|
||||||
// Skip the chrpath if the target does not need it.
|
// Skip the chrpath if the target does not need it.
|
||||||
if(this->ImportLibrary || !this->Target->IsChrpathUsed())
|
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -560,7 +560,7 @@ cmInstallTargetGenerator
|
|||||||
const char* config, std::string const& toDestDirPath)
|
const char* config, std::string const& toDestDirPath)
|
||||||
{
|
{
|
||||||
// Skip the chrpath if the target does not need it.
|
// Skip the chrpath if the target does not need it.
|
||||||
if(this->ImportLibrary || !this->Target->IsChrpathUsed())
|
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ void cmLocalUnixMakefileGenerator3
|
|||||||
|
|
||||||
// Add a local name for the rule to relink the target before
|
// Add a local name for the rule to relink the target before
|
||||||
// installation.
|
// installation.
|
||||||
if(t->second.NeedRelinkBeforeInstall())
|
if(t->second.NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
|
||||||
{
|
{
|
||||||
makeTargetName = this->GetRelativeTargetDirectory(t->second);
|
makeTargetName = this->GetRelativeTargetDirectory(t->second);
|
||||||
makeTargetName += "/preinstall";
|
makeTargetName += "/preinstall";
|
||||||
|
@ -60,7 +60,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
|
|||||||
|
|
||||||
// write the link rules
|
// write the link rules
|
||||||
this->WriteExecutableRule(false);
|
this->WriteExecutableRule(false);
|
||||||
if(this->Target->NeedRelinkBeforeInstall())
|
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName))
|
||||||
{
|
{
|
||||||
// Write rules to link an installable version of the target.
|
// Write rules to link an installable version of the target.
|
||||||
this->WriteExecutableRule(true);
|
this->WriteExecutableRule(true);
|
||||||
|
@ -72,7 +72,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
|
|||||||
break;
|
break;
|
||||||
case cmTarget::SHARED_LIBRARY:
|
case cmTarget::SHARED_LIBRARY:
|
||||||
this->WriteSharedLibraryRules(false);
|
this->WriteSharedLibraryRules(false);
|
||||||
if(this->Target->NeedRelinkBeforeInstall())
|
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName))
|
||||||
{
|
{
|
||||||
// Write rules to link an installable version of the target.
|
// Write rules to link an installable version of the target.
|
||||||
this->WriteSharedLibraryRules(true);
|
this->WriteSharedLibraryRules(true);
|
||||||
@ -80,7 +80,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
|
|||||||
break;
|
break;
|
||||||
case cmTarget::MODULE_LIBRARY:
|
case cmTarget::MODULE_LIBRARY:
|
||||||
this->WriteModuleLibraryRules(false);
|
this->WriteModuleLibraryRules(false);
|
||||||
if(this->Target->NeedRelinkBeforeInstall())
|
if(this->Target->NeedRelinkBeforeInstall(this->ConfigName))
|
||||||
{
|
{
|
||||||
// Write rules to link an installable version of the target.
|
// Write rules to link an installable version of the target.
|
||||||
this->WriteModuleLibraryRules(true);
|
this->WriteModuleLibraryRules(true);
|
||||||
|
@ -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
|
// Only executables and shared libraries can have an rpath and may
|
||||||
// need relinking.
|
// need relinking.
|
||||||
@ -3056,7 +3056,7 @@ bool cmTarget::NeedRelinkBeforeInstall()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If chrpath is going to be used no relinking is needed.
|
// If chrpath is going to be used no relinking is needed.
|
||||||
if(this->IsChrpathUsed())
|
if(this->IsChrpathUsed(config))
|
||||||
{
|
{
|
||||||
return false;
|
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)
|
#if defined(CMAKE_USE_ELF_PARSER)
|
||||||
// Only certain target types have an rpath.
|
// Only certain target types have an rpath.
|
||||||
@ -3405,6 +3405,7 @@ bool cmTarget::IsChrpathUsed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
static_cast<void>(config);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,13 +353,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Compute whether this target must be relinked before installing.
|
* Compute whether this target must be relinked before installing.
|
||||||
*/
|
*/
|
||||||
bool NeedRelinkBeforeInstall();
|
bool NeedRelinkBeforeInstall(const char* config);
|
||||||
|
|
||||||
bool HaveBuildTreeRPATH();
|
bool HaveBuildTreeRPATH();
|
||||||
bool HaveInstallTreeRPATH();
|
bool HaveInstallTreeRPATH();
|
||||||
|
|
||||||
/** Return true if builtin chrpath will work for this target */
|
/** Return true if builtin chrpath will work for this target */
|
||||||
bool IsChrpathUsed();
|
bool IsChrpathUsed(const char* config);
|
||||||
|
|
||||||
std::string GetInstallNameDirForBuildTree(const char* config,
|
std::string GetInstallNameDirForBuildTree(const char* config,
|
||||||
bool for_xcode = false);
|
bool for_xcode = false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user