diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-09-13 17:00:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-09-14 09:48:59 +0200 |
commit | d552de5d028e1dfb108f343810604d0dfd74c2e6 (patch) | |
tree | 3ed1a320b0c3788001a1c61ff468f3392630f789 /libbuild2/install/utility.cxx | |
parent | b9ea935ac2e31144db8ebdc2a98ebfc3f94357cc (diff) |
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)
Diffstat (limited to 'libbuild2/install/utility.cxx')
-rw-r--r-- | libbuild2/install/utility.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
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 <libbuild2/install/utility.hxx> + +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<string> (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; + } + } +} |