diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-31 12:52:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-31 12:52:20 +0200 |
commit | bbd0f3bb21442a2833916110cbe8e9a07e9f4c1f (patch) | |
tree | d25de6f2bcfa4b6cabe1fd55a1b8f508005de4c1 /build/config/utility.cxx | |
parent | 729b56300c441a0d63c7d2013eb5a881211d352b (diff) |
Essential install module functionality
Diffstat (limited to 'build/config/utility.cxx')
-rw-r--r-- | build/config/utility.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
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<const string&, bool> (v.as<const string&> (), 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; + } + } } } |