diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6ba0eedcd..192ad5f2b 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1925,7 +1925,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() && linking_for_install); bool use_build_rpath = - (outputRuntime && this->Target->Target->HaveBuildTreeRPATH(this->Config) && + (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) && !linking_for_install); bool use_link_rpath = outputRuntime && linking_for_install && diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44fac1d02..9dc045ca0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -909,7 +909,7 @@ cmGeneratorTarget::NeedRelinkBeforeInstall(const std::string& config) const // 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) + return this->HaveBuildTreeRPATH(config) || this->Target->HaveInstallTreeRPATH(); } @@ -4414,3 +4414,18 @@ cmGeneratorTarget::GetLinkImplementation(const std::string& config) const } return &impl; } + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const +{ + if (this->Target->GetPropertyAsBool("SKIP_BUILD_RPATH")) + { + return false; + } + if(cmLinkImplementationLibraries const* impl = + this->Target->GetLinkImplementationLibraries(config)) + { + return !impl->Libraries.empty(); + } + return false; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 58f5f6b15..99463c79b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -201,6 +201,8 @@ public: cmLinkImplementation const* GetLinkImplementation(const std::string& config) const; + bool HaveBuildTreeRPATH(const std::string& config) const; + /** Full path with trailing slash to the top-level directory holding object files for this target. Includes the build time config name placeholder if needed for the generator. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a8ea0b85c..9073f8276 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2809,21 +2809,6 @@ void cmTarget::SetPropertyDefault(const std::string& property, } } -//---------------------------------------------------------------------------- -bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const -{ - if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) - { - return false; - } - if(cmLinkImplementationLibraries const* impl = - this->GetLinkImplementationLibraries(config)) - { - return !impl->Libraries.empty(); - } - return false; -} - //---------------------------------------------------------------------------- bool cmTarget::HaveInstallTreeRPATH() const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1d353abe5..8866e65c4 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -294,7 +294,6 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0) const; - bool HaveBuildTreeRPATH(const std::string& config) const; bool HaveInstallTreeRPATH() const; // Get the properties