# Role of CXX\_MODULES file sets and how it is documented

**URL:** https://discourse.cmake.org/t/role-of-cxx-modules-file-sets-and-how-it-is-documented/9444
**Category:** Development
**Created:** [November 17, 2023, 3:39am UTC](https://discourse.cmake.org/t/role-of-cxx-modules-file-sets-and-how-it-is-documented/9444 "2023-11-17T03:39:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [November 17, 2023, 3:39am UTC](https://discourse.cmake.org/t/role-of-cxx-modules-file-sets-and-how-it-is-documented/9444/1 "2023-11-17T03:39:07Z")

</div>

I’m working through the new C++20 modules support, in particular the CMake docs around this new feature. Based on what I see in the `cmake-cxxmodules` manual, the `target_sources()` command help, the `install()` command help, and the `CMP0155` policy help, it seems like file sets of type `CXX_MODULES` are only really relevant if you intend to install a target. Based on the `cmake-cxxmodules` manual, the source files are still going to be scanned for typical cases even without any `CXX_MODULES` file sets (as long as `CMP0155` is set to `NEW`). Am I missing something?

I’m also finding the `install(TARGETS)` documentation a bit confusion for file set handling. There’s both the `FILE_SET` and `CXX_MODULES_BMI` keywords, and it isn’t all that obvious why two separate things are needed for installing a `CXX_MODULES` file set. From what I can tell, the `FILE_SET` part would be needed to install C++ source files with exported modules because right now, the binary compatibility of BMI’s is tough. My understanding is the user’s compiler is probably going to need to compile its own BMI unless it they are using the exact same version of the compiler as the ones installed with the `CXX_MODULES_BMI` argument, and they potentially use the same or very similar compiler flags. There’s no hint of these subtleties in our docs, and I suspect we may get queries about this with the docs as they stand. I’m also very likely misunderstanding the latest state of the compilers and BMI compatibility, so please do correct me where needed.

Sorry the above is a bit rushed and vague, I’d prefer to provide a more considered and tested query, but my availability at the moment is limited and unpredictable. Hopefully the above is enough to spur discussion around this though. I hope to spend more time on this area next week (from a documentation perspective), so getting a few basics ironed out ahead of that will be helpful.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 17, 2023, 3:40pm UTC](https://discourse.cmake.org/t/role-of-cxx-modules-file-sets-and-how-it-is-documented/9444/2 "2023-11-17T15:40:48Z")

</div>

It is on my list to write more docs in `cmake-cxxmodules(7)`. I have some things written locally, but need to finish up things.

See my comments on [this Reddit thread](https://www.reddit.com/r/cpp/comments/17a4t6l/the_road_to_hell_is_paved_with_good_intentions/) that is basically what all needs to be explained in the docs. I hope to have an MR up early next week for you to review.
