summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
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)
commit8d2de00244f8338664c16bd8d8ebb03c6f0cb83f (patch)
treefe846ed5d566ec5ba77ab8b250d01e1498231a9f /Source/cmGeneratorTarget.cxx
parent3df705681be123d93146156fec3166b41b19465a (diff)
downloadCMake-8d2de00244f8338664c16bd8d8ebb03c6f0cb83f.zip
CMake-8d2de00244f8338664c16bd8d8ebb03c6f0cb83f.tar.gz
CMake-8d2de00244f8338664c16bd8d8ebb03c6f0cb83f.tar.bz2
cmGeneratorTarget: Move NeedRelinkBeforeInstall from cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx67
1 files changed, 67 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a29f4c9..505d01f 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -714,6 +714,73 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const
}
//----------------------------------------------------------------------------
+bool
+cmGeneratorTarget::NeedRelinkBeforeInstall(const std::string& config) const
+{
+ // Only executables and shared libraries can have an rpath and may
+ // need relinking.
+ if(this->GetType() != cmTarget::EXECUTABLE &&
+ this->GetType() != cmTarget::SHARED_LIBRARY &&
+ this->GetType() != cmTarget::MODULE_LIBRARY)
+ {
+ return false;
+ }
+
+ // If there is no install location this target will not be installed
+ // and therefore does not need relinking.
+ if(!this->Target->GetHaveInstallRule())
+ {
+ return false;
+ }
+
+ // If skipping all rpaths completely then no relinking is needed.
+ if(this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
+ {
+ return false;
+ }
+
+ // If building with the install-tree rpath no relinking is needed.
+ if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
+ {
+ return false;
+ }
+
+ // If chrpath is going to be used no relinking is needed.
+ if(this->Target->IsChrpathUsed(config))
+ {
+ return false;
+ }
+
+ // Check for rpath support on this platform.
+ std::string ll = this->Target->GetLinkerLanguage(config);
+ if(!ll.empty())
+ {
+ std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
+ flagVar += ll;
+ flagVar += "_FLAG";
+ if(!this->Makefile->IsSet(flagVar))
+ {
+ // There is no rpath support on this platform so nothing needs
+ // relinking.
+ return false;
+ }
+ }
+ else
+ {
+ // No linker language is known. This error will be reported by
+ // other code.
+ return false;
+ }
+
+ // If either a build or install tree rpath is set then the rpath
+ // will likely change between the build tree and install tree and
+ // this target must be relinked.
+ return this->Target->HaveBuildTreeRPATH(config)
+ || this->Target->HaveInstallTreeRPATH();
+}
+
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
{
if(this->Target->IsImported())