From 4a4f6583b00a632977481c0f88b427912d5305a8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 12 Dec 2024 12:24:41 +0200 Subject: Generalize to_target() to be usable in other contexts --- libbuild2/functions-target.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libbuild2/functions-target.cxx') diff --git a/libbuild2/functions-target.cxx b/libbuild2/functions-target.cxx index c7cb50e..55baeda 100644 --- a/libbuild2/functions-target.cxx +++ b/libbuild2/functions-target.cxx @@ -35,6 +35,8 @@ namespace build2 if (s == nullptr) fail << "target.path() called out of scope"; + context& ctx (s->ctx); + // Most of the time we will have a single target so optimize for that. // small_vector r; @@ -42,7 +44,10 @@ namespace build2 for (auto i (ns.begin ()); i != ns.end (); ++i) { name& n (*i), o; - const target& t (to_target (*s, move (n), move (n.pair ? *++i : o))); + const target& t ( + to_target (*s, + move (n), move (n.pair ? *++i : o), + ctx.phase != run_phase::load /* in_recipe */)); if (const auto* pt = t.is_a ()) { @@ -94,7 +99,9 @@ namespace build2 name o; const target& t ( - to_target (*s, move (ns[0]), move (ns[0].pair ? ns[1] : o))); + to_target (*s, + move (ns[0]), move (ns[0].pair ? ns[1] : o), + s->ctx.phase != run_phase::load /* in_recipe */)); if (const auto* et = t.is_a ()) { -- cgit v1.1