diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-27 10:39:52 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-27 10:40:58 +0200 |
commit | 2cc2772263d17a9b2755990d53e992a94d37e29d (patch) | |
tree | 1ad8e98e564485ae87ebae9a6e3546798eeda7b4 /libbuild2/scope.ixx | |
parent | ee128a8d4c3d5739b31fbb9e935b319176837cc8 (diff) |
Implement project configuration reporting, similar to build system modules
Diffstat (limited to 'libbuild2/scope.ixx')
-rw-r--r-- | libbuild2/scope.ixx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbuild2/scope.ixx b/libbuild2/scope.ixx index ec36bf9..f13aa70 100644 --- a/libbuild2/scope.ixx +++ b/libbuild2/scope.ixx @@ -94,4 +94,22 @@ namespace build2 auto l (rs[rs.ctx.var_project]); return l ? cast<project_name> (l) : empty_project_name; } + + inline const project_name& + named_project (const scope& rs) + { + for (auto r (&rs), a (rs.strong_scope ()); + ; + r = r->parent_scope ()->root_scope ()) + { + const project_name& n (project (*r)); + if (!n.empty ()) + return n; + + if (r == a) + break; + } + + return empty_project_name; + } } |