diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-12-12 12:24:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-12-12 12:24:41 +0200 |
commit | 4a4f6583b00a632977481c0f88b427912d5305a8 (patch) | |
tree | 4782ba62dee6d93f8d80e31732ae26f6e0816833 /libbuild2/functions-name.cxx | |
parent | d27390e9935c94938af9e7068557d6f6ef9b07a9 (diff) |
Generalize to_target() to be usable in other contexts
Diffstat (limited to 'libbuild2/functions-name.cxx')
-rw-r--r-- | libbuild2/functions-name.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libbuild2/functions-name.cxx b/libbuild2/functions-name.cxx index 456f85b..cb32d09 100644 --- a/libbuild2/functions-name.cxx +++ b/libbuild2/functions-name.cxx @@ -49,7 +49,10 @@ namespace build2 } const target& - to_target (const scope& s, name&& n, name&& o) + to_target (const scope& s, + name&& n, name&& o, + bool in_recipe, + const location& loc) { // Note: help the user out and search in both out and src like a // prerequisite. @@ -62,13 +65,13 @@ namespace build2 // bool typed (n.typed ()); - diag_record dr (fail); + diag_record dr (fail (loc)); dr << "target " << (n.pair ? names {move (n), move (o)} : names {move (n)}) << " not found"; - if (!typed) + if (in_recipe && !typed) dr << info << "wrap it in ([names] ...) if this is literal target name " << "specified inside recipe"; @@ -76,12 +79,15 @@ namespace build2 } const target& - to_target (const scope& s, names&& ns) + to_target (const scope& s, names&& ns, bool in_recipe, const location& loc) { assert (ns.size () == (ns[0].pair ? 2 : 1)); name o; - return to_target (s, move (ns[0]), move (ns[0].pair ? ns[1] : o)); + return to_target (s, + move (ns[0]), move (ns[0].pair ? ns[1] : o), + in_recipe, + loc); } static bool |