aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/bin/rule.cxx16
-rw-r--r--build/cxx/rule.cxx16
2 files changed, 23 insertions, 9 deletions
diff --git a/build/bin/rule.cxx b/build/bin/rule.cxx
index 06fe72e..22b7bc2 100644
--- a/build/bin/rule.cxx
+++ b/build/bin/rule.cxx
@@ -77,6 +77,22 @@ namespace build
build::match (a, *t.so);
}
+ // Search and match prerequisite libraries and add them to the
+ // prerequisite targets. While we never execute this list
+ // ourselves (see perform() below), this is necessary to make
+ // the exported options machinery work for the library chains.
+ // See cxx.export.*-related code in cxx/rule.cxx for details.
+ //
+ for (prerequisite& p: group_prerequisites (t))
+ {
+ if (p.is_a<lib> () || p.is_a<liba> () || p.is_a<libso> ())
+ {
+ target& pt (search (p));
+ build::match (a, pt);
+ t.prerequisite_targets.push_back (&pt);
+ }
+ }
+
return &perform;
}
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx
index d5a9b9c..4fce59a 100644
--- a/build/cxx/rule.cxx
+++ b/build/cxx/rule.cxx
@@ -839,20 +839,18 @@ namespace build
//
pt->prerequisites.emplace_back (cp);
- // Add our imported lib*{} prerequisites to the object file (see
+ // Add our lib*{} prerequisites to the object file (see
// cxx.export.poptions above for details).
//
+ // Initially, we were only adding imported libraries, but
+ // there is a problem with this approach: the non-imported
+ // library might depend on the imported one(s) which we
+ // will never "see" unless we add this library as well.
+ //
for (prerequisite& p: group_prerequisites (t))
{
if (p.is_a<lib> () || p.is_a<liba> () || p.is_a<libso> ())
- {
- // Check that it is imported, that is its root scope differs
- // from ours.
- //
- if (p.dir.absolute () && // Imported is always absolute.
- scopes.find (p.dir).root_scope () != root)
- pt->prerequisites.emplace_back (p);
- }
+ pt->prerequisites.emplace_back (p);
}
build::match (a, *ot);