From 635f75c7b3fbb6053059827c73a4df52733850e0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Feb 2021 09:08:55 +0200 Subject: Generalize process_libraries() to allow no picking installed library member --- libbuild2/cc/compile-rule.cxx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'libbuild2/cc/compile-rule.cxx') diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 2c53a62..bd4b481 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -413,11 +413,13 @@ namespace build2 // See through utility libraries. // - auto imp = [] (const file& l, bool la) {return la && l.is_a ();}; + auto imp = [] (const target& l, bool la) {return la && l.is_a ();}; - auto opt = [&d, this] (const file& l, + auto opt = [&d, this] (const target& lt, const string& t, bool com, bool exp) { + const file& l (lt.as ()); + // Note that in our model *.export.poptions are always "interface", // even if set on liba{}/libs{}, unlike loptions. // @@ -504,10 +506,10 @@ namespace build2 target& t, linfo li) const { - auto imp = [] (const file& l, bool la) {return la && l.is_a ();}; + auto imp = [] (const target& l, bool la) {return la && l.is_a ();}; auto opt = [&m, this] ( - const file& l, const string& t, bool com, bool exp) + const target& l, const string& t, bool com, bool exp) { if (!exp) return; @@ -524,8 +526,8 @@ namespace build2 // The same logic as in append_library_options(). // - const function impf (imp); - const function optf (opt); + const function impf (imp); + const function optf (opt); for (prerequisite_member p: group_prerequisite_members (a, t)) { @@ -6097,10 +6099,7 @@ namespace build2 // Note that any such library would necessarily be an interface // dependency so we never need to go into implementations. // - auto imp = [] (const file&, bool) - { - return false; - }; + auto imp = [] (const target&, bool) { return false; }; // The same logic as in append_libraries(). // @@ -6111,7 +6110,7 @@ namespace build2 const file*& lt; } d {a, ht, lt}; - auto lib = [&d] (const file* const* lc, + auto lib = [&d] (const target* const* lc, const string&, lflags, bool) @@ -6121,7 +6120,7 @@ namespace build2 if (d.lt != nullptr) return; - const file* l (lc != nullptr ? *lc : nullptr); + const file* l (lc != nullptr ? &(*lc)->as () : nullptr); if (l == nullptr) return; @@ -6175,7 +6174,7 @@ namespace build2 process_libraries ( a, bs, li, sys_lib_dirs, *f, la, 0, // lflags unused. - imp, lib, {}, + imp, lib, nullptr, true); } } -- cgit v1.1