Date: Thu, 13 Oct 2022 19:02:19 +0000
> 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).
What do you mean by "too late"? If a source file (.h or .cpp) says "import <some-header>;", that shows up in the output of the dependency scanner, doesn’t it?
-- Gaby
-----Original Message-----
From: Ben Boeckel <ben.boeckel_at_kitware.com>
Sent: Thursday, October 13, 2022 11:58 AM
To: Gabriel Dos Reis <gdr_at_[hidden]>
Cc: sg15_at_lists.isocpp.org
Subject: Re: [SG15] Header units again.
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
> 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).
What do you mean by "too late"? If a source file (.h or .cpp) says "import <some-header>;", that shows up in the output of the dependency scanner, doesn’t it?
-- Gaby
-----Original Message-----
From: Ben Boeckel <ben.boeckel_at_kitware.com>
Sent: Thursday, October 13, 2022 11:58 AM
To: Gabriel Dos Reis <gdr_at_[hidden]>
Cc: sg15_at_lists.isocpp.org
Subject: Re: [SG15] Header units again.
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 19:02:22