From d552de5d028e1dfb108f343810604d0dfd74c2e6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 13 Sep 2021 17:00:08 +0200 Subject: Consistently install prerequisites from any scope by default It is also now possible to adjust this behavior with global config.install.scope override. Valid values for this variable are: project -- only from project strong -- from strong amalgamation weak -- from weak amalgamation global -- from all projects (default) --- libbuild2/install/utility.cxx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libbuild2/install/utility.cxx (limited to 'libbuild2/install/utility.cxx') diff --git a/libbuild2/install/utility.cxx b/libbuild2/install/utility.cxx new file mode 100644 index 0000000..12215f8 --- /dev/null +++ b/libbuild2/install/utility.cxx @@ -0,0 +1,32 @@ +// file : libbuild2/install/utility.cxx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +#include + +namespace build2 +{ + namespace install + { + const scope* + install_scope (const target& t) + { + context& ctx (t.ctx); + + const variable& var (*ctx.var_pool.find ("config.install.scope")); + + if (const string* s = cast_null (ctx.global_scope[var])) + { + if (*s == "project") + return &t.root_scope (); + else if (*s == "strong") + return &t.strong_scope (); + else if (*s == "weak") + return &t.weak_scope (); + else if (*s != "global") + fail << "invalid " << var << " value '" << *s << "'"; + } + + return nullptr; + } + } +} -- cgit v1.1