# C++20 modules in beman project libraries

**URL:** <https://discourse.bemanproject.org/t/c-20-modules-in-beman-project-libraries/279>\
**Category:** Beman Project Development\
**Tags:** cmake, packaging\
**Created:** [December 3, 2024, 8:29am UTC](https://discourse.bemanproject.org/t/c-20-modules-in-beman-project-libraries/279 "2024-12-03T08:29:11Z")\
**Posts on this page:** 1\
**Showing post:** 39

<div class="post-metadata">

**Author:** ![ClausKlein](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.bemanproject.org/clausklein/32/136_2.png) [@ClausKlein](https://discourse.bemanproject.org/u/ClausKlein)\
**Post date:** [March 3, 2026, 9:34am UTC](https://discourse.bemanproject.org/t/c-20-modules-in-beman-project-libraries/279/39 "2026-03-03T09:34:16Z")

</div>

First read [cmake-cxxmodules(7)](https://cmake.org/cmake/help/latest/manual/cmake-cxxmodules.7.html)

Than we have to know and decide which variant of **Standard C++ Modules** we want:

- [Transitioning to modules - abi-non-breaking-styles](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#https://clang.llvm.org/docs/StandardCPlusPlusModules.html#abi-non-breaking-styles)
- [Transitioning to modules - abi-breaking-style](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#abi-breaking-style)

`Daniela's` choice for the `fmt` library was [export-extern-c-style](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#export-extern-c-style)

This seems to be useful for existing header-only libraries like [asio](https://github.com/ClausKlein/asio/blob/feature/module/module/asio.ixx), [fmt](https://github.com/ClausKlein/fmt-module/blob/develop/module/fmt.cppm), and i.e. [beman.scope](https://github.com/bemanproject/scope/pull/53).

But note the performance tips and other recommendations:

- [The ABI of your library](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#the-abi-of-your-library)
- [Less duplicated generated code](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#less-duplicated-generated-code)
- [Providing a header to skip parsing redundant headers](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#providing-a-header-to-skip-parsing-redundant-headers)

Also note how we may want to [Importing modules](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#importing-modules) in other Beman libraries

and last but not least [Including headers after import is not well-supported](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#id61)

[Related boost cmake](https://github.com/boostorg/cmake/pull/105)  
[C++20 modules in Boost](https://github.com/anarthal/boost-cmake/blob/e29bc2a5bd3493d353bf597610d4b32b5a11d0dc/modules.md#c20-modules-in-boost)

---

_[View the full topic](https://discourse.bemanproject.org/t/c-20-modules-in-beman-project-libraries/279)._
