aboutsummaryrefslogtreecommitdiff
path: root/build/cxx/link.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-09 09:43:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-09 09:43:38 +0200
commit5f29fc16fb85a934280e00e54bc6307685c4e05d (patch)
tree4092c97dbeb8277ea8126209cb6bd936fdff442f /build/cxx/link.cxx
parent7c6333c365e8f36fff0f4d3957a56a50a11febc2 (diff)
Add support for specifying additional rpath's
For example: b config.bin.rpath=/usr/local/lib
Diffstat (limited to 'build/cxx/link.cxx')
-rw-r--r--build/cxx/link.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/build/cxx/link.cxx b/build/cxx/link.cxx
index f489a0d..7d6b15e 100644
--- a/build/cxx/link.cxx
+++ b/build/cxx/link.cxx
@@ -746,6 +746,7 @@ namespace build
scope& rs (t.root_scope ());
cstrings args;
string storage1;
+ strings rpaths;
if (lt == type::a)
{
@@ -767,6 +768,18 @@ namespace build
args.push_back ("-o");
args.push_back (relt.string ().c_str ());
+ if (auto l = t["bin.rpath"])
+ {
+ const auto& ps (as<strings> (*l));
+ rpaths.reserve (ps.size ()); // Make sure no reallocations.
+
+ for (const string& p: ps)
+ {
+ rpaths.push_back ("-Wl,-rpath," + p);
+ args.push_back (rpaths.back ().c_str ());
+ }
+ }
+
append_options (args, t, "cxx.loptions");
}