blob: c2a581ee4fff96ea51848171263994b5f3197762 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// 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);
// Note: go straight for the public variable pool.
//
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 == "bundle")
return &t.bundle_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;
}
}
}
|