C++ Logo

sg15

Advanced search

Re: Header units again.

From: Ben Boeckel <ben.boeckel_at_[hidden]>
Date: Thu, 13 Oct 2022 14:58:18 -0400
On Thu, Oct 13, 2022 at 17:51:36 +0000, Gabriel Dos Reis wrote:
> "import <some-header>;" is arguably the marking of such header as
> "importable".
>
> I believe it is unfortunate that the term "importable" made it into
> the standards text as it creates an endless source of confusion.
> It is not a property that is determinable before the import is
> executed, other than by fiat.

While fine, that is discovered far too late for CMake to do much of
anything about (as the build graph is already made at this point and is
static in Ninja generators; Makefiles is more flexible, but needs
serious synchronization to avoid duplicate rule generation).

Note that I do forsee an API that does something like:

```
cmake_discover_importable_headers(
  TARGET MyTarget::WithImportableHeaders
  HEADER_ROOT "${WithImportableHeaders_INCLUDE_DIR}"
  REGEX_EXCLUDE "unimportable\\.h")
```

to populate the metadata for `Find` modules to use.

--Ben

Received on 2022-10-13 18:58:21