diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index d35b566ad7..d907dd0261 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1920,7 +1920,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, (for_install || this->Target->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")); bool use_install_rpath = - (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() && + (outputRuntime && this->Target->HaveInstallTreeRPATH() && linking_for_install); bool use_build_rpath = (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) && diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3a67d2c5b1..6ad6c69283 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1212,7 +1212,7 @@ cmGeneratorTarget::NeedRelinkBeforeInstall(const std::string& config) const // will likely change between the build tree and install tree and // this target must be relinked. return this->HaveBuildTreeRPATH(config) - || this->Target->HaveInstallTreeRPATH(); + || this->HaveInstallTreeRPATH(); } //---------------------------------------------------------------------------- @@ -4694,6 +4694,14 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind, return true; } +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::HaveInstallTreeRPATH() const +{ + const char* install_rpath = this->GetProperty("INSTALL_RPATH"); + return (install_rpath && *install_rpath) && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"); +} + //---------------------------------------------------------------------------- void cmGeneratorTarget::ComputeLinkInterfaceLibraries( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 4ca0447f00..f068cae3b5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -407,6 +407,8 @@ public: class TargetPropertyEntry; + bool HaveInstallTreeRPATH() const; + private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector Depends; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 40f93a31de..dd1d405edb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2383,14 +2383,6 @@ void cmTarget::SetPropertyDefault(const std::string& property, } } -//---------------------------------------------------------------------------- -bool cmTarget::HaveInstallTreeRPATH() const -{ - const char* install_rpath = this->GetProperty("INSTALL_RPATH"); - return (install_rpath && *install_rpath) && - !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"); -} - //---------------------------------------------------------------------------- const char* cmTarget::GetOutputTargetType(bool implib) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index d37f934ae4..4b369d322b 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -262,8 +262,6 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0) const; - bool HaveInstallTreeRPATH() const; - // Get the properties cmPropertyMap &GetProperties() const { return this->Properties; }