aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-04-27 09:34:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-04-27 09:34:07 +0200
commit64eb9a61dd9bdac1006821af187f48df19b64792 (patch)
tree10244403b9d06c4e06728c3d85fb3d68cc374846 /libbuild2/algorithm.cxx
parentab6917b035a8431a13d85396ed15b75dabe44b36 (diff)
Add another search_existing() overload
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r--libbuild2/algorithm.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 7788b90..4e47c63 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -112,6 +112,8 @@ namespace build2
assert (s.ctx.phase == run_phase::match ||
s.ctx.phase == run_phase::execute);
+ // See also scope::find_prerequisite_key().
+ //
name n (cn);
auto rp (s.find_target_type (n, location ()));
const target_type* tt (rp.first);
@@ -139,6 +141,20 @@ namespace build2
: search_existing_target (s.ctx, pk);
}
+ const target*
+ search_existing (const names& ns, const scope& s)
+ {
+ if (size_t n = ns.size ())
+ {
+ if (n == (ns[0].pair ? 2 : 1))
+ {
+ return search_existing (ns[0], s, n == 1 ? dir_path () : ns[1].dir);
+ }
+ }
+
+ fail << "invalid target name: " << ns << endf;
+ }
+
// target_lock
//
// Note that the stack may contain locks for targets from multiple nested