fileapi: List C++20 module files
I've tried to experiment with C++20 modules in the recent 3.25 rc build. It works! However, there is no additional information regarding modules in file API. Currently, all module files (those listed under FILE_SET cxx_modules TYPE CXX_MODULES FILES <module-files>
) are simply listed as a regular Source Files
the same as other files.
Since CMake already requires module files to be listed separately, it would be great, if this was somehow reflected in file-api.
Suggestion:
Currently, I see several ways this can be done with the fewest changes to current file-api:
- Add a separate
sourceGroup
for eachFILE_SET
with either a specialname
, or introduce a new fieldtype
that will correspond toFILE_SET
type. This can potentially disrupt current behavior withsource_group()
command, but not sure. - Add a separate
compileGroup
for eachFILE_SET
with new fieldtype
that will correspond toFILE_SET
type. - Introduce a new field
type
to each entry insources
list that will specify if the current source is a module
For the context:
In CLion, we need information if the file exports some module to be able to apply additional processing. AFAIK, CMake requires the similar info to create a build graph. Currently, CLion uses file extension to determine which files export modules (.cppm
, .ixx
). However, this doesn't always work since often users export modules from regular .cpp
files. CLion can additionally scan source files and look for export module <name>
instructions, but this is a time-consuming operation, and we would like to avoid it.