diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-05-26 21:35:59 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-06-03 12:26:33 +0300 |
commit | 920ed11a433b0e292a18adb8c68829a00e8c70cc (patch) | |
tree | e365baf8be68b168e19f42f20c5dde1526c1cbba /libbuild2/target.txx | |
parent | 4001ff053071c09008e88312c4f973c417322a07 (diff) |
Allow process path values and targets as buildscript program names
Also deduce the recipe name.
Diffstat (limited to 'libbuild2/target.txx')
-rw-r--r-- | libbuild2/target.txx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbuild2/target.txx b/libbuild2/target.txx index b482d64..ef14cf5 100644 --- a/libbuild2/target.txx +++ b/libbuild2/target.txx @@ -179,4 +179,22 @@ namespace build2 t.prerequisites (move (ps)); return &t; } + + // exe + // + template <typename T> + const T* exe:: + lookup_metadata (const char* var) const + { + if (auto* ns = cast_null<names> (vars[ctx.var_export_metadata])) + { + // Metadata variable prefix is in the second name. + // + assert (ns->size () == 2 && (*ns)[1].simple ()); + + return cast_null<T> (vars[(*ns)[1].value + '.' + var]); + } + + return nullptr; + } } |