From dd4a389117812f0d3b45473d87214d67d0cb4a3a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 12 Dec 2015 09:00:14 +0200 Subject: Add bin.libprefix to override default library prefix --- build/bin/module.cxx | 3 +++ build/cxx/link.cxx | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'build') 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 (v); + // Configure "installability" of our target types. // install::path (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 (*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 (*l).c_str () : "lib"); + break; + } } } -- cgit v1.1