From bbd0f3bb21442a2833916110cbe8e9a07e9f4c1f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 31 Jul 2015 12:52:20 +0200 Subject: Essential install module functionality --- build/config/utility.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'build/config/utility.cxx') diff --git a/build/config/utility.cxx b/build/config/utility.cxx index 212d030..e2afc80 100644 --- a/build/config/utility.cxx +++ b/build/config/utility.cxx @@ -37,5 +37,35 @@ namespace build return pair (v.as (), true); } + + bool + specified (scope& r, const string& ns) + { + // Search all outer scopes for any value in this namespace. + // + for (scope* s (&r); s != nullptr; s = s->parent_scope ()) + { + auto p (s->vars.find_namespace (ns)); + if (p.first != p.second) + return true; + } + + return false; + } + + void + append_options (cstrings& args, const list_value& lv, const char* var) + { + for (const name& n: lv) + { + if (n.simple ()) + args.push_back (n.value.c_str ()); + else if (n.directory ()) + args.push_back (n.dir.string ().c_str ()); + else + fail << "expected option instead of " << n << + info << "in variable " << var; + } + } } } -- cgit v1.1