diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-06-06 18:00:10 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-06-06 18:00:10 +0200 |
commit | daa35c9e4b592f055b42e482fe1398527cfdf90b (patch) | |
tree | ba6d14f100b58d2d3b38b9d1ff76b553ad84f4a3 /build2/cc/module.cxx | |
parent | 6bbdd5e594deb3a7143461fe657ad495e95bbafd (diff) |
Fix cc link rule matching ambiguity wrt to C/C++ sources
Considering a C header as C++ source was definitely a bad idea.
Diffstat (limited to 'build2/cc/module.cxx')
-rw-r--r-- | build2/cc/module.cxx | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index 7527da2..14d3ceb 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -578,24 +578,32 @@ namespace build2 { using namespace install; - auto& t (rs.target_types); + auto& tts (rs.target_types); - t.insert (x_src); + tts.insert (x_src); - // Note: module (x_mod) is in x_hdr. - - for (const target_type* const* ht (x_hdr); *ht != nullptr; ++ht) + auto insert_hdr = [&rs, &tts, install_loaded] (const target_type& tt) { - t.insert (**ht); + tts.insert (tt); // Install headers into install.include. // if (install_loaded) - install_path (rs, **ht, dir_path ("include")); - } + install_path (rs, tt, dir_path ("include")); + }; + + // Note: module (x_mod) is in x_hdr. + // + for (const target_type* const* ht (x_hdr); *ht != nullptr; ++ht) + insert_hdr (**ht); + + // Also register the C header for C-derived languages. + // + if (*x_hdr != &h::static_type) + insert_hdr (h::static_type); - t.insert<pca> (); - t.insert<pcs> (); + tts.insert<pca> (); + tts.insert<pcs> (); if (install_loaded) install_path<pc> (rs, dir_path ("pkgconfig")); |