From f918e62bcb9c6dec5c6302a55710f9850087fe9a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Aug 2017 15:37:54 +0200 Subject: Install archive prerequisites of libraries --- build2/cc/install.cxx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx index 72d9218..050ab1e 100644 --- a/build2/cc/install.cxx +++ b/build2/cc/install.cxx @@ -41,11 +41,14 @@ namespace build2 // If this is a shared library prerequisite, install it as long as it // is in the same amalgamation as we are. // - // @@ Shouldn't we also install a static library prerequisite of a - // static library? + // Less obvious: we also want to install a static library prerequisite + // of a library (since it could be referenced from its .pc file, etc). // - if ((t.is_a () || t.is_a ()) && - (p.is_a () || p.is_a ())) + bool st (t.is_a () || t.is_a ()); // Target needs shared. + bool at (t.is_a () || t.is_a ()); // Target needs static. + + if ((st && (p.is_a () || p.is_a ())) || + (at && (p.is_a () || p.is_a ()))) { const target* pt (&p.search (t)); @@ -56,7 +59,7 @@ namespace build2 pt = &link_member ( *l, a, link_info (t.base_scope (), link_type (t).type)); - if (pt->is_a ()) // Can be liba{}. + if ((st && pt->is_a ()) || (at && pt->is_a ())) return pt->in (t.weak_scope ()) ? pt : nullptr; // See through libux{}. Note that we are always in the same project @@ -179,8 +182,11 @@ namespace build2 return nullptr; } - if ((t.is_a () || t.is_a ()) && - (p.is_a () || p.is_a ())) + bool st (t.is_a () || t.is_a ()); // Target needs shared. + bool at (t.is_a () || t.is_a ()); // Target needs static. + + if ((st && (p.is_a () || p.is_a ())) || + (at && (p.is_a () || p.is_a ()))) { const target* pt (&p.search (t)); @@ -188,7 +194,7 @@ namespace build2 pt = &link_member ( *l, a, link_info (t.base_scope (), link_type (t).type)); - if (pt->is_a ()) + if ((st && pt->is_a ()) || (at && pt->is_a ())) return pt->in (t.weak_scope ()) ? pt : nullptr; if (pt->is_a ()) -- cgit v1.1