summaryrefslogtreecommitdiffstats
path: root/Source/cmLinkLineComputer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLinkLineComputer.cxx')
-rw-r--r--Source/cmLinkLineComputer.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index a5e8b72..3675887 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -12,6 +12,7 @@ cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
, OutputConverter(outputConverter)
, ForResponse(false)
, UseWatcomQuote(false)
+ , Relink(false)
{
}
@@ -29,6 +30,11 @@ void cmLinkLineComputer::SetForResponse(bool forResponse)
this->ForResponse = forResponse;
}
+void cmLinkLineComputer::SetRelink(bool relink)
+{
+ this->Relink = relink;
+}
+
std::string cmLinkLineComputer::ConvertToLinkReference(
std::string const& lib) const
{
@@ -100,3 +106,33 @@ std::string cmLinkLineComputer::ComputeLinkPath(
}
return linkPath;
}
+
+std::string cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli)
+{
+ std::string rpath;
+ // Check what kind of rpath flags to use.
+ if (cli.GetRuntimeSep().empty()) {
+ // Each rpath entry gets its own option ("-R a -R b -R c")
+ std::vector<std::string> runtimeDirs;
+ cli.GetRPath(runtimeDirs, this->Relink);
+
+ for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
+ ri != runtimeDirs.end(); ++ri) {
+ rpath += cli.GetRuntimeFlag();
+ rpath += this->ConvertToOutputFormat(*ri);
+ rpath += " ";
+ }
+ } else {
+ // All rpath entries are combined ("-Wl,-rpath,a:b:c").
+ std::string rpathString = cli.GetRPathString(this->Relink);
+
+ // Store the rpath option in the stream.
+ if (!rpathString.empty()) {
+ rpath += cli.GetRuntimeFlag();
+ rpath +=
+ this->OutputConverter->EscapeForShell(rpathString, !this->ForResponse);
+ rpath += " ";
+ }
+ }
+ return rpath;
+}