From 41cad5bba8a718a0403c0578660c60e81c9f46e4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 27 Jun 2016 16:59:09 +0200 Subject: Add config.bin.target var/hint, use to decide libso{} install mode Normally the user doesn't need to specify config.bin.target explicitly since the cxx module will hint it. We now also have the whole set of target's components: bin.target.{cpu,vendor,system,version,class} --- build2/variable | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'build2/variable') diff --git a/build2/variable b/build2/variable index 5c567da..adc11fa 100644 --- a/build2/variable +++ b/build2/variable @@ -280,13 +280,13 @@ namespace build2 // A variable can be undefined, NULL, or contain a (potentially empty) // value. // - struct variable_map; + class variable_map; struct lookup { using value_type = build2::value; - const value_type* value; + const value_type* value; // NULL if undefined. const variable_map* vars; bool @@ -701,28 +701,36 @@ namespace build2 value* find (const variable&); - // The second member in the pair indicates whether the new value (which - // will be NULL) was assigned. + // Return a value suitable for assignment. See scope for details. // - pair, bool> - assign (const variable&); + value& + assign (const variable& var) {return insert (var).first;} - pair, bool> - assign (const string& name) - { - return assign (var_pool.find (name)); - } + value& + assign (const string& name) {return insert (name).first;} - // Unlike the two above, assign a non-overridable variable with normal - // visibility. + // Unlike the two above, assign a typed, non-overridable variable with + // normal visibility. // template - pair, bool> + value& assign (string name) { return assign (var_pool.insert (move (name))); } + // As above but also return an indication of whether the new value (which + // will be NULL) was actually inserted. + // + pair, bool> + insert (const variable&); + + pair, bool> + insert (const string& name) + { + return insert (var_pool.find (name)); + } + pair find_namespace (const string& ns) const { -- cgit v1.1