diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-24 18:53:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-24 18:53:19 +0200 |
commit | 99116592590c0face4ec37a2e0308e9c3a2f98dd (patch) | |
tree | d4e9bcb11b6b2699c4e2276e431dfefb55a4af29 | |
parent | 1d6e68fda762535fa8508f94ca254a79f293edb2 (diff) |
Fix bugs in dependency extraction code
-rw-r--r-- | build/cxx/compile.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/build/cxx/compile.cxx b/build/cxx/compile.cxx index 4095598..ae1ebe2 100644 --- a/build/cxx/compile.cxx +++ b/build/cxx/compile.cxx @@ -212,8 +212,16 @@ namespace build { tracer trace ("cxx::append_prefixes"); + // If this target does not belong to any project (e.g, an + // "imported as installed" library), then it can't possibly + // generate any headers for us. + // + scope* rs (t.base_scope ().root_scope ()); + if (rs == nullptr) + return; + const dir_path& out_base (t.dir); - const dir_path& out_root (t.root_scope ().path ()); + const dir_path& out_root (rs->path ()); if (auto val = t[var]) { @@ -558,9 +566,13 @@ namespace build { const dir_path& d (f.directory ()); i = pm.upper_bound (d); - --i; // Greatest less than. - if (!d.sub (i->first)) // We might still not be a sub. + // Get the greatest less than, if any. We might + // still not be a sub. Note also that we still + // have to check the last element is upper_bound() + // returned end(). + // + if (i == pm.begin () || !d.sub ((--i)->first)) i = pm.end (); } |