diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 15:47:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 15:47:26 +0200 |
commit | b846f3c80db66a6efedbe43f0048f084e0e1ec97 (patch) | |
tree | ade4c8985628c60adfda2cc67bde449e3c7cb580 | |
parent | 9693eae0d4fddb148bd5fd663a7a2e802d3e4666 (diff) |
Tweak generated header prefix mapping heuristics
-rw-r--r-- | build2/cc/compile.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index fbf6a19..c0fc55b 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -993,11 +993,18 @@ namespace build2 // installed" library), then it can't possibly generate any headers for // us. // - const scope* rs (t.base_scope ().root_scope ()); + const scope& bs (t.base_scope ()); + const scope* rs (bs.root_scope ()); if (rs == nullptr) return; - const dir_path& out_base (t.dir); + // We used to use the target's directory as out_base but that didn't + // work well for targets that are stashed in subdirectories. So as a + // heuristics we are using the path of the innermost scope (i.e., where + // the buildfile normally is). + // + //const dir_path& out_base (t.dir); + const dir_path& out_base (bs.out_path ()); const dir_path& out_root (rs->out_path ()); if (auto l = t[var]) @@ -1083,7 +1090,8 @@ namespace build2 auto compile:: build_prefix_map (const scope& bs, target& t, - action act, linfo li) const -> prefix_map + action act, + linfo li) const -> prefix_map { prefix_map m; @@ -1907,7 +1915,12 @@ namespace build2 } if (pt == nullptr) - fail << "header '" << f << "' not found and cannot be generated"; + { + diag_record dr (fail); + dr << "header '" << f << "' not found and cannot be generated"; + //for (const auto& p: pm) + // dr << info << p.first.string () << " -> " << p.second.string (); + } } else { |