diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-05 10:54:48 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-05 10:54:48 +0200 |
commit | 9525ffdb54cd1dbe55a2d8d2ed3d351d8793a8e3 (patch) | |
tree | cf3cb9e725e3d0d25025aaaab33e3b605023162c /libbuild2/cc/link-rule.cxx | |
parent | aa44a864777e9896956ff6dae8fd66ddbaae6db8 (diff) |
Allow linking libraries without any sources/headers with hint
This can be useful for creating "metadata libraries".
Diffstat (limited to 'libbuild2/cc/link-rule.cxx')
-rw-r--r-- | libbuild2/cc/link-rule.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index c186751..f8414c9 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -483,10 +483,15 @@ namespace build2 return false; } - if (!(r.seen_x || r.seen_c || r.seen_obj || r.seen_lib)) + // Sometimes we may need to have a binless library whose only purpose is + // to export dependencies on other libraries (potentially in a platform- + // specific manner; think the whole -pthread mess). So allow a library + // without any sources with a hint. + // + if (!(r.seen_x || r.seen_c || r.seen_obj || r.seen_lib || !hint.empty ())) { - l4 ([&]{trace << "no " << x_lang << ", C, or obj/lib prerequisite " - << "for target " << t;}); + l4 ([&]{trace << "no " << x_lang << ", C, obj/lib prerequisite or " + << "hint for target " << t;}); return false; } |