aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-16 09:43:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-16 10:51:49 +0200
commitaf73b1603d851dcb2ce7ae84bd57df0c2f9a716d (patch)
tree2c59bbf5ecdb2b5cec2f8f656ee3f7b13bc1b97b /libbuild2/bin/init.cxx
parentecfae2da0b23631cee3e723a562f64f8aace6879 (diff)
Add $bin.link_member() function
Given a linker output target type ("exe", "lib[as]", or "libu[eas]") return the target type of lib{} group member ("liba" or "libs") that will be picked when linking a lib{} group to this target type.
Diffstat (limited to 'libbuild2/bin/init.cxx')
-rw-r--r--libbuild2/bin/init.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index a1ac61e..0d2d9b5 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -6,6 +6,7 @@
#include <map>
#include <libbuild2/scope.hxx>
+#include <libbuild2/function.hxx>
#include <libbuild2/variable.hxx>
#include <libbuild2/diagnostics.hxx>
@@ -137,6 +138,9 @@ namespace build2
return true;
}
+ void
+ functions (function_map&); // functions.cxx
+
bool
config_init (scope& rs,
scope& bs,
@@ -153,6 +157,14 @@ namespace build2
if (rs != bs)
fail (loc) << "bin.config module must be loaded in project root";
+ context& ctx (rs.ctx);
+
+ // Register the bin function family if this is the first instance of the
+ // bin modules.
+ //
+ if (!function_family::defined (ctx.functions, "bin"))
+ functions (ctx.functions);
+
// Load bin.vars.
//
load_module (rs, rs, "bin.vars", loc);
@@ -267,7 +279,7 @@ namespace build2
// config.bin.target
//
{
- const variable& var (rs.ctx.var_pool["config.bin.target"]);
+ const variable& var (ctx.var_pool["config.bin.target"]);
// We first see if the value was specified via the configuration
// mechanism.
@@ -343,7 +355,7 @@ namespace build2
// config.bin.pattern
//
{
- const variable& var (rs.ctx.var_pool["config.bin.pattern"]);
+ const variable& var (ctx.var_pool["config.bin.pattern"]);
// We first see if the value was specified via the configuration
// mechanism.