summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-26 11:13:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-06-26 11:14:04 (GMT)
commit06f1560a58391d29b10697b2d5462966cd417b2f (patch)
tree1b845cb7d0effffeec2ea73d63ac681b8bede9e8 /Source
parent9b68e4b1836ff39043ebf34aec5d1e97cebbeabc (diff)
parentd29ed8a1148d317a5743c0210a3b97d42d41e0a0 (diff)
downloadCMake-06f1560a58391d29b10697b2d5462966cd417b2f.zip
CMake-06f1560a58391d29b10697b2d5462966cd417b2f.tar.gz
CMake-06f1560a58391d29b10697b2d5462966cd417b2f.tar.bz2
Merge topic 'build-install-rpath-genex'
d29ed8a114 BUILD_RPATH/INSTALL_RPATH: Add generator expression support Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3481
Diffstat (limited to 'Source')
-rw-r--r--Source/cmComputeLinkInformation.cxx12
-rw-r--r--Source/cmGeneratorTarget.cxx39
-rw-r--r--Source/cmGeneratorTarget.h8
3 files changed, 48 insertions, 11 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 44d8615..b366ebb 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1695,7 +1695,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
(for_install ||
this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"));
bool use_install_rpath =
- (outputRuntime && this->Target->HaveInstallTreeRPATH() &&
+ (outputRuntime && this->Target->HaveInstallTreeRPATH(this->Config) &&
linking_for_install);
bool use_build_rpath =
(outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) &&
@@ -1715,15 +1715,17 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// Construct the RPATH.
std::set<std::string> emitted;
if (use_install_rpath) {
- const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH");
- cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted);
+ std::string install_rpath;
+ this->Target->GetInstallRPATH(this->Config, install_rpath);
+ cmCLI_ExpandListUnique(install_rpath.c_str(), runtimeDirs, emitted);
}
if (use_build_rpath) {
// Add directories explicitly specified by user
- if (const char* build_rpath = this->Target->GetProperty("BUILD_RPATH")) {
+ std::string build_rpath;
+ if (this->Target->GetBuildRPATH(this->Config, build_rpath)) {
// This will not resolve entries to use $ORIGIN, the user is expected to
// do that if necessary.
- cmCLI_ExpandListUnique(build_rpath, runtimeDirs, emitted);
+ cmCLI_ExpandListUnique(build_rpath.c_str(), runtimeDirs, emitted);
}
}
if (use_build_rpath || use_link_rpath) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index de0f371..85a8dbb 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1612,7 +1612,7 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
// will likely change between the build tree and install tree and
// this target must be relinked.
bool have_rpath =
- this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH();
+ this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH(config);
bool is_ninja =
this->LocalGenerator->GetGlobalGenerator()->GetName() == "Ninja";
@@ -5479,13 +5479,41 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
return true;
}
-bool cmGeneratorTarget::HaveInstallTreeRPATH() const
+bool cmGeneratorTarget::HaveInstallTreeRPATH(const std::string& config) const
{
- const char* install_rpath = this->GetProperty("INSTALL_RPATH");
- return (install_rpath && *install_rpath) &&
+ std::string install_rpath;
+ this->GetInstallRPATH(config, install_rpath);
+ return !install_rpath.empty() &&
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
}
+bool cmGeneratorTarget::GetBuildRPATH(const std::string& config,
+ std::string& rpath) const
+{
+ return this->GetRPATH(config, "BUILD_RPATH", rpath);
+}
+
+bool cmGeneratorTarget::GetInstallRPATH(const std::string& config,
+ std::string& rpath) const
+{
+ return this->GetRPATH(config, "INSTALL_RPATH", rpath);
+}
+
+bool cmGeneratorTarget::GetRPATH(const std::string& config,
+ const std::string& prop,
+ std::string& rpath) const
+{
+ const char* value = this->GetProperty(prop);
+ if (!value) {
+ return false;
+ }
+
+ cmGeneratorExpression ge;
+ rpath = ge.Parse(value)->Evaluate(this->LocalGenerator, config);
+
+ return true;
+}
+
void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
const std::string& config, cmOptionalLinkInterface& iface,
cmGeneratorTarget const* headTarget, bool usage_requirements_only) const
@@ -6085,7 +6113,8 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) {
return false;
}
- if (this->GetProperty("BUILD_RPATH")) {
+ std::string build_rpath;
+ if (this->GetBuildRPATH(config, build_rpath)) {
return true;
}
if (cmLinkImplementationLibraries const* impl =
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 0e0ee6a..627a055 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -674,7 +674,10 @@ public:
class TargetPropertyEntry;
- bool HaveInstallTreeRPATH() const;
+ bool HaveInstallTreeRPATH(const std::string& config) const;
+
+ bool GetBuildRPATH(const std::string& config, std::string& rpath) const;
+ bool GetInstallRPATH(const std::string& config, std::string& rpath) const;
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
@@ -913,6 +916,9 @@ private:
ManagedType CheckManagedType(std::string const& propval) const;
+ bool GetRPATH(const std::string& config, const std::string& prop,
+ std::string& rpath) const;
+
public:
const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure(
const std::string& config) const;