From 64eb9a61dd9bdac1006821af187f48df19b64792 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 27 Apr 2020 09:34:07 +0200 Subject: Add another search_existing() overload --- libbuild2/algorithm.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libbuild2/algorithm.cxx') 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 -- cgit v1.1