From 9891b20350021ce41a950645dd76df20a45c92cc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Dec 2015 11:37:15 +0200 Subject: Implement optional module loading The syntax is: using? cli Now each module use results in two bool variables: .loaded and .configured. Also implement variable visibility (the above two variables are limited to project). --- build/target.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'build/target.cxx') diff --git a/build/target.cxx b/build/target.cxx index 85eec66..5c31311 100644 --- a/build/target.cxx +++ b/build/target.cxx @@ -133,7 +133,7 @@ namespace build // We cannot simply delegate to scope's lookup() since we also need // to check the group. // - for (const scope* s (&base_scope ()); s != nullptr; s = s->parent_scope ()) + for (const scope* s (&base_scope ()); s != nullptr; ) { if (!s->target_vars.empty ()) { @@ -149,6 +149,19 @@ namespace build if (auto r = s->vars.find (var)) return result (r, &s->vars); + + switch (var.visibility) + { + case variable_visibility::scope: + s = nullptr; + break; + case variable_visibility::project: + s = s->root () ? nullptr : s->parent_scope (); + break; + case variable_visibility::normal: + s = s->parent_scope (); + break; + } } return result (); -- cgit v1.1