aboutsummaryrefslogtreecommitdiff
path: root/build/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-24 09:51:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-24 14:52:43 +0200
commit68f96f9213e849d0d7c4cedf3edeaec99743ee27 (patch)
tree271913d74c906971cac555319f5e14d0c66e0c16 /build/cli
parent0d5234f4aefd3cc5b5948cc1b9dd009e50046f5e (diff)
New variable architecture
Diffstat (limited to 'build/cli')
-rw-r--r--build/cli/module.cxx20
-rw-r--r--build/cli/rule.cxx2
2 files changed, 16 insertions, 6 deletions
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<cxx::ixx> (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<string> (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<list_value> (root, "config.cli.options"))
- base.assign ("cli.options") += *v;
+ if (const value& v = config::optional (root, "config.cli.options"))
+ base.assign ("cli.options") += as<strings> (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&> ());
+ const string& cli (as<string> (*rs["config.cli"]));
cstrings args {cli.c_str ()};