summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-08-04 17:19:46 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-08-05 16:20:47 (GMT)
commite27d737e27fbfc8cfde020ec02d6b2c74afb6885 (patch)
tree895ab57e59489993a842ff5b8f081988f5dfc9d1 /Source
parent8d2de00244f8338664c16bd8d8ebb03c6f0cb83f (diff)
downloadCMake-e27d737e27fbfc8cfde020ec02d6b2c74afb6885.zip
CMake-e27d737e27fbfc8cfde020ec02d6b2c74afb6885.tar.gz
CMake-e27d737e27fbfc8cfde020ec02d6b2c74afb6885.tar.bz2
cmGeneratorTarget: Move IsChrPathUsed from cmTarget.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmComputeLinkInformation.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx69
-rw-r--r--Source/cmGeneratorTarget.h3
-rw-r--r--Source/cmInstallTargetGenerator.cxx5
-rw-r--r--Source/cmTarget.cxx67
-rw-r--r--Source/cmTarget.h3
6 files changed, 78 insertions, 75 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 72db6f8..b7555a6 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -321,7 +321,11 @@ cmComputeLinkInformation
this->RuntimeAlways =
(this->Makefile->
GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH"));
- this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config);
+
+ cmGeneratorTarget *gtgt = this->Target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this->Target);
+ this->RuntimeUseChrpath = gtgt->IsChrpathUsed(config);
// Get options needed to help find dependent libraries.
std::string rlVar = "CMAKE_";
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 505d01f..6481390 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -746,7 +746,7 @@ cmGeneratorTarget::NeedRelinkBeforeInstall(const std::string& config) const
}
// If chrpath is going to be used no relinking is needed.
- if(this->Target->IsChrpathUsed(config))
+ if(this->IsChrpathUsed(config))
{
return false;
}
@@ -779,6 +779,73 @@ cmGeneratorTarget::NeedRelinkBeforeInstall(const std::string& config) const
|| this->Target->HaveInstallTreeRPATH();
}
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
+{
+ // Only certain target types have an rpath.
+ if(!(this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->GetType() == cmTarget::MODULE_LIBRARY ||
+ this->GetType() == cmTarget::EXECUTABLE))
+ {
+ return false;
+ }
+
+ // If the target will not be installed we do not need to change its
+ // rpath.
+ if(!this->Target->GetHaveInstallRule())
+ {
+ return false;
+ }
+
+ // Skip chrpath if skipping rpath altogether.
+ if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
+ {
+ return false;
+ }
+
+ // Skip chrpath if it does not need to be changed at install time.
+ if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
+ {
+ return false;
+ }
+
+ // Allow the user to disable builtin chrpath explicitly.
+ if(this->Makefile->IsOn("CMAKE_NO_BUILTIN_CHRPATH"))
+ {
+ return false;
+ }
+
+ if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ {
+ return true;
+ }
+
+#if defined(CMAKE_USE_ELF_PARSER)
+ // Enable if the rpath flag uses a separator and the target uses ELF
+ // binaries.
+ std::string ll = this->Target->GetLinkerLanguage(config);
+ if(!ll.empty())
+ {
+ std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
+ sepVar += ll;
+ sepVar += "_FLAG_SEP";
+ const char* sep = this->Makefile->GetDefinition(sepVar);
+ if(sep && *sep)
+ {
+ // TODO: Add ELF check to ABI detection and get rid of
+ // CMAKE_EXECUTABLE_FORMAT.
+ if(const char* fmt =
+ this->Makefile->GetDefinition("CMAKE_EXECUTABLE_FORMAT"))
+ {
+ return strcmp(fmt, "ELF") == 0;
+ }
+ }
+ }
+#endif
+ static_cast<void>(config);
+ return false;
+}
+
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index c9a2508..9ecbbbe 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -215,6 +215,9 @@ public:
*/
bool NeedRelinkBeforeInstall(const std::string& config) const;
+ /** Return true if builtin chrpath will work for this target */
+ bool IsChrpathUsed(const std::string& config) const;
+
struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7a7dcb4..24c1c49 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -656,11 +656,10 @@ cmInstallTargetGenerator
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
- if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config))
+ if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
{
return;
}
-
// Skip if on Apple
if(this->Target->Target->GetMakefile()
->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
@@ -695,7 +694,7 @@ cmInstallTargetGenerator
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
- if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config))
+ if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
{
return;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8dd62f9..1183fe4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4314,73 +4314,6 @@ void cmTarget::GetLanguages(std::set<std::string>& languages,
}
//----------------------------------------------------------------------------
-bool cmTarget::IsChrpathUsed(const std::string& config) const
-{
- // Only certain target types have an rpath.
- if(!(this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->GetType() == cmTarget::MODULE_LIBRARY ||
- this->GetType() == cmTarget::EXECUTABLE))
- {
- return false;
- }
-
- // If the target will not be installed we do not need to change its
- // rpath.
- if(!this->GetHaveInstallRule())
- {
- return false;
- }
-
- // Skip chrpath if skipping rpath altogether.
- if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
- {
- return false;
- }
-
- // Skip chrpath if it does not need to be changed at install time.
- if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
- {
- return false;
- }
-
- // Allow the user to disable builtin chrpath explicitly.
- if(this->Makefile->IsOn("CMAKE_NO_BUILTIN_CHRPATH"))
- {
- return false;
- }
-
- if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
- {
- return true;
- }
-
-#if defined(CMAKE_USE_ELF_PARSER)
- // Enable if the rpath flag uses a separator and the target uses ELF
- // binaries.
- std::string ll = this->GetLinkerLanguage(config);
- if(!ll.empty())
- {
- std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
- sepVar += ll;
- sepVar += "_FLAG_SEP";
- const char* sep = this->Makefile->GetDefinition(sepVar);
- if(sep && *sep)
- {
- // TODO: Add ELF check to ABI detection and get rid of
- // CMAKE_EXECUTABLE_FORMAT.
- if(const char* fmt =
- this->Makefile->GetDefinition("CMAKE_EXECUTABLE_FORMAT"))
- {
- return strcmp(fmt, "ELF") == 0;
- }
- }
- }
-#endif
- static_cast<void>(config);
- return false;
-}
-
-//----------------------------------------------------------------------------
cmTarget::ImportInfo const*
cmTarget::GetImportInfo(const std::string& config) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 11f715a..1aef7b3 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -398,9 +398,6 @@ public:
bool HaveBuildTreeRPATH(const std::string& config) const;
bool HaveInstallTreeRPATH() const;
- /** Return true if builtin chrpath will work for this target */
- bool IsChrpathUsed(const std::string& config) const;
-
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */