From af73b1603d851dcb2ce7ae84bd57df0c2f9a716d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 16 Jun 2020 09:43:59 +0200 Subject: 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. --- libbuild2/bin/init.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libbuild2/bin/init.cxx') 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 #include +#include #include #include @@ -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. -- cgit v1.1