C++ Logo


Advanced search

Re: Header units again.

From: Ben Boeckel <ben.boeckel_at_[hidden]>
Date: Thu, 13 Oct 2022 13:40:28 -0400
On Thu, Oct 13, 2022 at 09:41:27 +0100, Iain Sandoe via SG15 wrote:
> * AFAICT, the build system can figure that a source depends on a
> specific header, but it is also not able to determine if that header
> is an “importable” one (except for the sub-set that are pre-defined to
> be). Which means that we probably require that the user’s project
> defines which headers are importable. That disconnects metadata from
> the sources which is undesirable, if not a recipe for bugs.

FWIW, the plan in CMake is to require metadata. If a header is not known
to be importable by CMake, no scanning of it will be performed, no
BMI-generating command will be in the graph, and therefore `import
<some-header>;` will fail to be resolved at build time (without compiler
magic going behind CMake's back, but that's just asking for ODR problems
if you ask me) because CMake won't know to add it via the "module map"
provided to compilation.

This also goes for standard library headers (though this list can be
provided by CMake itself once header units are supported beyond "not


Received on 2022-10-13 17:40:31