From 68f96f9213e849d0d7c4cedf3edeaec99743ee27 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Aug 2015 09:51:15 +0200 Subject: New variable architecture --- build/cli/module.cxx | 20 +++++++++++++++----- build/cli/rule.cxx | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'build/cli') diff --git a/build/cli/module.cxx b/build/cli/module.cxx index f112cd4..7702589 100644 --- a/build/cli/module.cxx +++ b/build/cli/module.cxx @@ -78,6 +78,16 @@ namespace build rs.insert (clean_id, "cli.compile", compile_); } + // Enter module variables. + // + if (first) + { + variable_pool.find ("config.cli", string_type); //@@ VAR type + + variable_pool.find ("config.cli.options", strings_type); + variable_pool.find ("cli.options", strings_type); + } + // Configure. // @@ -85,13 +95,13 @@ namespace build // if (first) { - auto r (config::required (root, "config.cli", "cli")); + auto p (config::required (root, "config.cli", "cli")); // If we actually set a new value, test it by trying to execute. // - if (r.second) + if (p.second) { - const string& cli (r.first); + const string& cli (as (p.first)); const char* args[] = {cli.c_str (), "--version", nullptr}; if (verb) @@ -142,8 +152,8 @@ namespace build // cli.* variables. See the cxx module for more information on // this merging semantics and some of its tricky aspects. // - if (auto* v = config::optional (root, "config.cli.options")) - base.assign ("cli.options") += *v; + if (const value& v = config::optional (root, "config.cli.options")) + base.assign ("cli.options") += as (v); } } } diff --git a/build/cli/rule.cxx b/build/cli/rule.cxx index 247b5b4..a892d7c 100644 --- a/build/cli/rule.cxx +++ b/build/cli/rule.cxx @@ -223,7 +223,7 @@ namespace build path rels (relative (s->path ())); scope& rs (t.root_scope ()); - const string& cli (rs["config.cli"].as ()); + const string& cli (as (*rs["config.cli"])); cstrings args {cli.c_str ()}; -- cgit v1.1