aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/functions-target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-12-12 12:24:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-12-12 12:24:41 +0200
commit4a4f6583b00a632977481c0f88b427912d5305a8 (patch)
tree4782ba62dee6d93f8d80e31732ae26f6e0816833 /libbuild2/functions-target.cxx
parentd27390e9935c94938af9e7068557d6f6ef9b07a9 (diff)
Generalize to_target() to be usable in other contexts
Diffstat (limited to 'libbuild2/functions-target.cxx')
-rw-r--r--libbuild2/functions-target.cxx11
1 files changed, 9 insertions, 2 deletions
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<path, 1> 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<path_target> ())
{
@@ -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<exe> ())
{