From 8a7b3bb944ca08d240fc778a9269c6db0f9746f8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 Feb 2017 09:56:42 +0200 Subject: Modify library mate-information protocol not to use lib{} group --- build2/cc/link.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'build2/cc/link.cxx') diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx index 0aef9f0..269b11f 100644 --- a/build2/cc/link.cxx +++ b/build2/cc/link.cxx @@ -126,7 +126,7 @@ namespace build2 // Set the library type. // - t.vars.assign (c_type) = string (x); + t.vars.assign (c_type) = string (x); //@@ move to apply()? // If we have any prerequisite libraries, search/import and pre-match // them to implement the "library meta-information protocol". Don't do @@ -140,8 +140,8 @@ namespace build2 op != install_id && oop != install_id && op != uninstall_id && oop != uninstall_id) { - if (t.group != nullptr) - t.group->prerequisite_targets.clear (); // lib{}'s + const scope& bs (t.base_scope ()); + lorder lo (link_order (bs, lt)); optional usr_lib_dirs; // Extract lazily. @@ -159,15 +159,13 @@ namespace build2 if (pt == nullptr) { pt = &p.search (); + + if (lib* l = pt->is_a ()) + pt = &link_member (*l, lo); + match_only (ml, a, *pt); } - // If the prerequisite came from the lib{} group, then also - // add it to lib's prerequisite_targets. - // - if (!p.prerequisite.belongs (t)) - t.group->prerequisite_targets.push_back (pt); - t.prerequisite_targets.push_back (pt); } } @@ -486,8 +484,10 @@ namespace build2 // altogether. So we are going to use the target's project. // - // @@ Why are we creating the obj{} group if the source came from a - // group? + // If the source came from the lib{} group, then create the obj{} + // group and add the source as a prerequisite of the obj{} group, + // not the obj?{} member. This way we only need one prerequisite + // for, say, both liba{} and libs{}. // bool group (!p.prerequisite.belongs (t)); // Group's prerequisite. -- cgit v1.1