cmTarget: add support for C++ module fileset types

C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
This commit is contained in:
Ben Boeckel
2022-04-08 13:56:33 -04:00
parent ff30a5397d
commit 386465bf83
82 changed files with 1294 additions and 78 deletions
@@ -0,0 +1,8 @@
add_library(module-header)
target_sources(module-header
INTERFACE
FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
sources/module-header.h)
target_compile_features(module-header
PRIVATE
cxx_std_20)