From 2cc2772263d17a9b2755990d53e992a94d37e29d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Mar 2020 10:39:52 +0200 Subject: Implement project configuration reporting, similar to build system modules --- libbuild2/scope.ixx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libbuild2/scope.ixx') 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 (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; + } } -- cgit v1.1