aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/compile-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-12-03 11:00:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-12-03 11:00:24 +0200
commite85e618a1b918f7279133eb1f446c1af871f5dd2 (patch)
tree7919bde56f6e549c0f96ce85801bba467187aa8e /libbuild2/cc/compile-rule.cxx
parent548bdfb7bdd7c4761b58bed18b0032afc05b3ce4 (diff)
Fix modules support for installed libraries
Diffstat (limited to 'libbuild2/cc/compile-rule.cxx')
-rw-r--r--libbuild2/cc/compile-rule.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx
index eba58fd..7cea9d6 100644
--- a/libbuild2/cc/compile-rule.cxx
+++ b/libbuild2/cc/compile-rule.cxx
@@ -768,18 +768,23 @@ namespace build2
{
// Handle (phase two) imported libraries. We know that for such
// libraries we don't need to do match() in order to get options
- // (if any, they would be set by search_library()).
+ // (if any, they would be set by search_library()). But we do need
+ // to match it if we may need its modules (see search_modules()
+ // for details).
//
if (p.proj ())
{
- if (search_library (a,
- sys_lib_dirs,
- usr_lib_dirs,
- p.prerequisite) != nullptr)
+ pt = search_library (a,
+ sys_lib_dirs,
+ usr_lib_dirs,
+ p.prerequisite);
+
+ if (pt != nullptr && !modules)
continue;
}
- pt = &p.search (t);
+ if (pt == nullptr)
+ pt = &p.search (t);
if (const libx* l = pt->is_a<libx> ())
pt = link_member (*l, a, li);
@@ -836,7 +841,7 @@ namespace build2
// resolved and prerequisite_targets populated. So we match it but
// then unmatch if it is safe. And thanks to the two-pass prerequisite
// match in link::apply() it will be safe unless someone is building
- // an obj?{} target directory.
+ // an obj?{} target directly.
//
pair<bool, target_state> mr (
build2::match (
@@ -5588,6 +5593,11 @@ namespace build2
// The module names should be specified but if not assume
// something else is going on and ignore.
//
+ // Note also that besides modules, prerequisite_targets may
+ // contain libraries which are interface dependencies of this
+ // library and which may be called to resolve its module
+ // dependencies.
+ //
const string* n (cast_null<string> (bt->vars[c_module_name]));
if (n == nullptr)