aboutsummaryrefslogtreecommitdiff
path: root/build2/prerequisite.hxx
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.hxx
parent84fa9cc11a76c41277ab04329e8b37cad08a0f9a (diff)
Initial support for prerequisite-specific variables, use for bin.whole
Diffstat (limited to 'build2/prerequisite.hxx')
-rw-r--r--build2/prerequisite.hxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/build2/prerequisite.hxx b/build2/prerequisite.hxx
index 77d96bf..eef91e6 100644
--- a/build2/prerequisite.hxx
+++ b/build2/prerequisite.hxx
@@ -10,6 +10,7 @@
#include <build2/types.hxx>
#include <build2/utility.hxx>
+#include <build2/variable.hxx>
#include <build2/target-key.hxx>
#include <build2/diagnostics.hxx>
@@ -82,6 +83,23 @@ namespace build2
//
mutable atomic<const target_type*> target {nullptr};
+ // Prerequisite-specific variables.
+ //
+ public:
+ variable_map vars;
+
+ // Return a value suitable for assignment. See target for details.
+ //
+ value&
+ assign (const variable& var) {return vars.assign (var);}
+
+ // Return a value suitable for appending. See target for details. Note
+ // that we have to explicitly pass the target that this prerequisite
+ // belongs to.
+ //
+ value&
+ append (const variable&, const target_type&);
+
public:
prerequisite (optional<string> p,
const target_type_type& t,
@@ -96,7 +114,8 @@ namespace build2
out (move (o)),
name (move (n)),
ext (move (e)),
- scope (s) {}
+ scope (s),
+ vars (false /* global */) {}
// Make a prerequisite from a target.
//
@@ -141,7 +160,8 @@ namespace build2
name (move (x.name)),
ext (move (x.ext)),
scope (move (x.scope)),
- target (x.target.load (memory_order_relaxed)) {}
+ target (x.target.load (memory_order_relaxed)),
+ vars (move (x.vars)) {}
prerequisite (const prerequisite& x, memory_order o = memory_order_consume)
: proj (x.proj),
@@ -151,7 +171,8 @@ namespace build2
name (x.name),
ext (x.ext),
scope (x.scope),
- target (x.target.load (o)) {}
+ target (x.target.load (o)),
+ vars (x.vars) {}
};
inline ostream&