From a3a046643aeb6244ac71a3cd645239099c6345f3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2009 13:03:47 -0400 Subject: 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. --- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 7 ++++--- Source/cmInstallTargetGenerator.cxx | 6 +++--- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 4 ++-- Source/cmTarget.cxx | 7 ++++--- Source/cmTarget.h | 4 ++-- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 7be0d85..4ca6817 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -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_"; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 6538936..14a7e16 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -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"; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index dc3b139..44f3b04 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -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; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index b5779bc..923e43f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -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"; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index cebdf59..e9ac80c 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -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); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 00935b8..9c92824 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -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); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 58cf24e..4003190 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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& 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(config); return false; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 46c268e..4ce6b30 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -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); -- cgit v0.12