aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/scope.ixx')
-rw-r--r--libbuild2/scope.ixx18
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;
+ }
}