diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-11 15:14:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-11 15:14:19 +0200 |
commit | cd10a583ad1f3c299383c07fd8c6ccd6e3199e6b (patch) | |
tree | acf33fe1a9c03fadf8e96ea1b78a89ff7de95372 /libbuild2/cc/utility.ixx | |
parent | 60a95915aa1fda93d308158416071ba39286d41c (diff) |
Add ${c,cxx}.lib_{poptions,libs,rpaths}() functions
These functions can be used to query library metadata for options and
libraries that should be used when compiling/linking dependent targets,
similar to how cc::{compile,link}_rule do it. With this support it should
be possible to more or less re-create their semantics in ad hoc recipes.
Diffstat (limited to 'libbuild2/cc/utility.ixx')
-rw-r--r-- | libbuild2/cc/utility.ixx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libbuild2/cc/utility.ixx b/libbuild2/cc/utility.ixx index 0b94780..46a4d0d 100644 --- a/libbuild2/cc/utility.ixx +++ b/libbuild2/cc/utility.ixx @@ -6,21 +6,23 @@ namespace build2 namespace cc { inline otype - compile_type (const target& t, unit_type u) + compile_type (const target_type& t, optional<unit_type> u) { using namespace bin; auto test = [&t, u] (const auto& h, const auto& i, const auto& o) { - return t.is_a (u == unit_type::module_header ? h : - u == unit_type::module_iface ? i : - o); + return (u + ? t.is_a (*u == unit_type::module_header ? h : + *u == unit_type::module_iface ? i : o) + : t.is_a (h) || t.is_a (i) || t.is_a (o)); }; return test (hbmie::static_type, bmie::static_type, obje::static_type) ? otype::e : + test (hbmis::static_type, bmis::static_type, objs::static_type) ? otype::s : test (hbmia::static_type, bmia::static_type, obja::static_type) ? otype::a : - otype::s; + static_cast<otype> (0xFF); } inline compile_target_types |