aboutsummaryrefslogtreecommitdiff
path: root/build2/prerequisite.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-09 13:33:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-09 13:33:06 +0200
commit3b0df49b8828921edfb7b764b0628fb164dab852 (patch)
tree31796318acfe4a25d90381242f1f4a127f0c9aab /build2/prerequisite.cxx
parent84fa9cc11a76c41277ab04329e8b37cad08a0f9a (diff)
Initial support for prerequisite-specific variables, use for bin.whole
Diffstat (limited to 'build2/prerequisite.cxx')
-rw-r--r--build2/prerequisite.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/build2/prerequisite.cxx b/build2/prerequisite.cxx
index 7facbaa..6233ec4 100644
--- a/build2/prerequisite.cxx
+++ b/build2/prerequisite.cxx
@@ -65,7 +65,8 @@ namespace build2
name (t.name),
ext (to_ext (t.ext ())),
scope (t.base_scope ()),
- target (&t)
+ target (&t),
+ vars (false /* global */)
{
}
@@ -75,4 +76,22 @@ namespace build2
const auto& p (t.prerequisites ());
return !(p.empty () || this < &p.front () || this > &p.back ());
}
+
+ value& prerequisite::
+ append (const variable& var, const target_type& t)
+ {
+ if (value* r = vars.find_to_modify (var))
+ return *r;
+
+ value& r (assign (var)); // NULL.
+
+ // Note: pretty similar logic to target::append().
+ //
+ lookup l (t.find_original (var).first);
+
+ if (l.defined ())
+ r = *l; // Copy value (and type) from the target/outer scope.
+
+ return r;
+ }
}