aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/algorithm.hxx7
-rw-r--r--libbuild2/algorithm.ixx7
2 files changed, 14 insertions, 0 deletions
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index d15810c..28b76c4 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -423,6 +423,13 @@ namespace build2
const target*
resolve_group (action, const target&);
+ // Inject a target as a "prerequisite target" (note: not a prerequisite) of
+ // another target. Specifically, first match the prerequisite target and
+ // then add it to the back of the dependent target's prerequisite_targets.
+ //
+ void
+ inject (action, target&, const target& prereq);
+
// Inject dependency on the target's directory fsdir{}, unless it is in the
// src tree or is outside of any project (say, for example, an installation
// directory). If the parent argument is true, then inject the parent
diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx
index 9c656fd..c421218 100644
--- a/libbuild2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -476,6 +476,13 @@ namespace build2
return t.group;
}
+ inline void
+ inject (action a, target& t, const target& p)
+ {
+ match (a, p);
+ t.prerequisite_targets[a].emplace_back (&p);
+ }
+
LIBBUILD2_SYMEXPORT void
match_prerequisites (action, target&, const match_search&, const scope*);