diff options
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; + } + } +} |