瀏覽代碼

Fix RPATH information when only a genex is used as a link library.

As of commit 1da75022 (Don't include generator expressions in
old-style link handling., 2012-12-23), such entries are not
included in the LinkLibraries member. Generator expressions in
LinkLibraries are not processed anyway, so port to the new way
of getting link information.
Stephen Kelly 12 年之前
父節點
當前提交
dcb5907ed6
共有 3 個文件被更改,包括 11 次插入6 次删除
  1. 1 1
      Source/cmComputeLinkInformation.cxx
  2. 9 4
      Source/cmTarget.cxx
  3. 1 1
      Source/cmTarget.h

+ 1 - 1
Source/cmComputeLinkInformation.cxx

@@ -1816,7 +1816,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
     (outputRuntime && this->Target->HaveInstallTreeRPATH() &&
      linking_for_install);
   bool use_build_rpath =
-    (outputRuntime && this->Target->HaveBuildTreeRPATH() &&
+    (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) &&
      !linking_for_install);
   bool use_link_rpath =
     outputRuntime && linking_for_install &&

+ 9 - 4
Source/cmTarget.cxx

@@ -4253,10 +4253,15 @@ void cmTarget::SetPropertyDefault(const char* property,
 }
 
 //----------------------------------------------------------------------------
-bool cmTarget::HaveBuildTreeRPATH()
+bool cmTarget::HaveBuildTreeRPATH(const char *config)
 {
-  return (!this->GetPropertyAsBool("SKIP_BUILD_RPATH") &&
-          !this->LinkLibraries.empty());
+  if (this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
+    {
+    return false;
+    }
+  std::vector<std::string> libs;
+  this->GetDirectLinkLibraries(config, libs, this);
+  return !libs.empty();
 }
 
 //----------------------------------------------------------------------------
@@ -4327,7 +4332,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config)
   // 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->HaveBuildTreeRPATH() || this->HaveInstallTreeRPATH();
+  return this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH();
 }
 
 //----------------------------------------------------------------------------

+ 1 - 1
Source/cmTarget.h

@@ -401,7 +401,7 @@ public:
    */
   bool NeedRelinkBeforeInstall(const char* config);
 
-  bool HaveBuildTreeRPATH();
+  bool HaveBuildTreeRPATH(const char *config);
   bool HaveInstallTreeRPATH();
 
   /** Return true if builtin chrpath will work for this target */