google / google/prefab

[FR] Support c++ modules

Open
#180 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
236
Forks
33
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Since CMake 3.28, it supports c++ modules (see https://www.kitware.com/import-cmake-the-experiment-is-over/). We can set file set `CXX_MODULES` for a library so library or executable depend on it can use its module interface unit. However, prefab does not support c++ modules. The cmake package it generates does not set the `CXX_MODULES` file set.

**Describe the solution you'd like**
Generate `CXX_MODULES` file set for the cmake package generated for a prefab package.

**Describe alternatives you've considered**
In AGP, we can set `headers` directory in `prefab.package`, maybe it's better to add `modules` to set the directory for module interface unit.

Or we can use hardcode some extensions (e.g., `.ixx`, `.cxx`, `.cppm`) to generate the `CXX_MODULES` file set instead of add a new directory.

**Additional context**
```kotlin
"""target_sources($name INTERFACE FILE_SET CXX_MODULES BASE_DIRS "$includes" FILES
"${files.joinToString(';')}")"""
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.