aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-14 16:47:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-14 16:47:39 +0200
commit6c769243ef185782ba1ae08ef2a9f4ded17f3949 (patch)
tree9c2f84f2cb5c4ab16fe3bca00e04710756b3b835 /build
parentd4eecda55cc543a5bf4f478d1a6d50a4c8a01ac4 (diff)
Make sure we don't link up to lib{} targets that are derived from liba/so{}
Diffstat (limited to 'build')
-rw-r--r--build/bin/target.cxx12
-rw-r--r--build/parser.cxx6
2 files changed, 13 insertions, 5 deletions
diff --git a/build/bin/target.cxx b/build/bin/target.cxx
index 6f2d7b5..735c581 100644
--- a/build/bin/target.cxx
+++ b/build/bin/target.cxx
@@ -91,9 +91,11 @@ namespace build
};
static target*
- liba_factory (const target_type&, dir_path d, string n, const string* e)
+ liba_factory (const target_type& t, dir_path d, string n, const string* e)
{
- lib* l (targets.find<lib> (d, n));
+ // Only link-up to the group if the types match exactly.
+ //
+ lib* l (t == liba::static_type ? targets.find<lib> (d, n) : nullptr);
liba* a (new liba (move (d), move (n), e));
if ((a->group = l))
@@ -126,9 +128,11 @@ namespace build
};
static target*
- libso_factory (const target_type&, dir_path d, string n, const string* e)
+ libso_factory (const target_type& t, dir_path d, string n, const string* e)
{
- lib* l (targets.find<lib> (d, n));
+ // Only link-up to the group if the types match exactly.
+ //
+ lib* l (t == libso::static_type ? targets.find<lib> (d, n) : nullptr);
libso* so (new libso (move (d), move (n), e));
if ((so->group = l))
diff --git a/build/parser.cxx b/build/parser.cxx
index e238628..1893b70 100644
--- a/build/parser.cxx
+++ b/build/parser.cxx
@@ -885,7 +885,11 @@ namespace build
static target*
derived_factory (const target_type& t, dir_path d, string n, const string* e)
{
- target* r (t.base->factory (*t.base, move (d), move (n), e));
+ // Pass our type to the base factory so that it can detect that it is
+ // being called to construct a derived target. This can be used, for
+ // example, to decide whether to "link up" to the group.
+ //
+ target* r (t.base->factory (t, move (d), move (n), e));
r->derived_type = &t;
return r;
}