aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-12 09:00:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-12 09:00:14 +0200
commitdd4a389117812f0d3b45473d87214d67d0cb4a3a (patch)
tree72cf98c514352b78382dcb9f84c2268a14798a82
parentc642d8673124b8667123a01a32fa7e83b6301aab (diff)
Add bin.libprefix to override default library prefix
-rw-r--r--build/bin/module.cxx3
-rw-r--r--build/cxx/link.cxx19
2 files changed, 19 insertions, 3 deletions
diff --git a/build/bin/module.cxx b/build/bin/module.cxx
index e17463c..5f65b8d 100644
--- a/build/bin/module.cxx
+++ b/build/bin/module.cxx
@@ -57,6 +57,8 @@ namespace build
v.find ("bin.liba.lib", strings_type);
v.find ("bin.libso.lib", strings_type);
v.find ("bin.rpath", strings_type); //@@ VAR paths_type
+
+ v.find ("bin.libprefix", string_type);
}
// Register target types.
@@ -152,6 +154,7 @@ namespace build
if (const value& v = config::optional (r, "config.bin.rpath"))
b.assign ("bin.rpath") += as<strings> (v);
+
// Configure "installability" of our target types.
//
install::path<exe> (b, dir_path ("bin")); // Install into install.bin.
diff --git a/build/cxx/link.cxx b/build/cxx/link.cxx
index a00b92e..f5a2e3d 100644
--- a/build/cxx/link.cxx
+++ b/build/cxx/link.cxx
@@ -461,11 +461,24 @@ namespace build
//
if (t.path ().empty ())
{
+ auto l (t["extension"]);
+ const char* e (l ? as<string> (*l).c_str () : nullptr);
+
switch (lt)
{
- case type::e: t.derive_path ("" ); break;
- case type::a: t.derive_path ("a", "lib"); break;
- case type::so: t.derive_path ("so", "lib"); break;
+ case type::e:
+ {
+ t.derive_path (e != nullptr ? e : "");
+ break;
+ }
+ case type::a:
+ case type::so:
+ {
+ auto l (t["bin.libprefix"]);
+ t.derive_path (e != nullptr ? e : (lt == type::a ? "a" : "so"),
+ l ? as<string> (*l).c_str () : "lib");
+ break;
+ }
}
}