aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/utility.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/cc/utility.cxx')
-rw-r--r--build2/cc/utility.cxx58
1 files changed, 37 insertions, 21 deletions
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx
index 7a03b54..fa5061e 100644
--- a/build2/cc/utility.cxx
+++ b/build2/cc/utility.cxx
@@ -39,34 +39,50 @@ namespace build2
}
const target&
- link_member (const bin::lib& l, action a, lorder lo)
+ link_member (const bin::libx& x, action a, linfo li)
{
- // Make sure group members are resolved.
- //
- group_view gv (resolve_group_members (a, l));
- assert (gv.members != nullptr);
-
- bool ls (true);
- switch (lo)
+ if (const libu* u = x.is_a<libu> ())
{
- case lorder::a:
- case lorder::a_s:
- ls = false; // Fall through.
- case lorder::s:
- case lorder::s_a:
+ otype ot (li.type);
+ return search (*u,
+ ot == otype::e ? libue::static_type :
+ ot == otype::a ? libua::static_type :
+ libus::static_type,
+ u->dir, u->out, u->name);
+ }
+ else
+ {
+ const lib& l (x.as<lib> ());
+
+ // Make sure group members are resolved.
+ //
+ group_view gv (resolve_group_members (a, l));
+ assert (gv.members != nullptr);
+
+ lorder lo (li.order);
+
+ bool ls (true);
+ switch (lo)
{
- if (ls ? l.s == nullptr : l.a == nullptr)
+ case lorder::a:
+ case lorder::a_s:
+ ls = false; // Fall through.
+ case lorder::s:
+ case lorder::s_a:
{
- if (lo == lorder::a_s || lo == lorder::s_a)
- ls = !ls;
- else
- fail << (ls ? "shared" : "static") << " variant of " << l
- << " is not available";
+ if (ls ? l.s == nullptr : l.a == nullptr)
+ {
+ if (lo == lorder::a_s || lo == lorder::s_a)
+ ls = !ls;
+ else
+ fail << (ls ? "shared" : "static") << " variant of " << l
+ << " is not available";
+ }
}
}
- }
- return *(ls ? static_cast<const target*> (l.s) : l.a);
+ return *(ls ? static_cast<const target*> (l.s) : l.a);
+ }
}
}
}