diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-06-27 16:59:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-06-27 16:59:09 +0200 |
commit | 41cad5bba8a718a0403c0578660c60e81c9f46e4 (patch) | |
tree | 7eebba42dac307fdfcf600f5f6527afe0c0f4fea /build2/variable | |
parent | 34cc74df52ed129bffeb7b6fcf11f05c222550ba (diff) |
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}
Diffstat (limited to 'build2/variable')
-rw-r--r-- | build2/variable | 36 |
1 files changed, 22 insertions, 14 deletions
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<reference_wrapper<value>, bool> - assign (const variable&); + value& + assign (const variable& var) {return insert (var).first;} - pair<reference_wrapper<value>, 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 <typename T> - pair<reference_wrapper<value>, bool> + value& assign (string name) { return assign (var_pool.insert<T> (move (name))); } + // As above but also return an indication of whether the new value (which + // will be NULL) was actually inserted. + // + pair<reference_wrapper<value>, bool> + insert (const variable&); + + pair<reference_wrapper<value>, bool> + insert (const string& name) + { + return insert (var_pool.find (name)); + } + pair<const_iterator, const_iterator> find_namespace (const string& ns) const { |