diff options
-rw-r--r-- | libbuild2/functions-name.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libbuild2/functions-name.cxx b/libbuild2/functions-name.cxx index 84608d4..a853db1 100644 --- a/libbuild2/functions-name.cxx +++ b/libbuild2/functions-name.cxx @@ -48,9 +48,22 @@ namespace build2 if (const target* r = search_existing (n, s, o.dir)) return *r; - fail << "target " - << (n.pair ? names {move (n), move (o)} : names {move (n)}) - << " not found" << endf; + // Inside recipes we don't treat `{}` as special so a literal target name + // will have no type and won't be found, which is confusing as hell. + // + bool typed (n.typed ()); + + diag_record dr (fail); + + dr << "target " + << (n.pair ? names {move (n), move (o)} : names {move (n)}) + << " not found"; + + if (!typed) + dr << info << "wrap it in ([names] ...) if this is literal target name " + << "specified inside recipe"; + + dr << endf; } const target& |