CMAKE-CXXMODULES(7) | CMake | CMAKE-CXXMODULES(7) |
cmake-cxxmodules - CMake C++ Modules Support Reference
New in version 3.28.
C++ 20 introduced the concept of "modules" to the language. The design requires build systems to order compilations among each other to satisfy import statements reliably. CMake's implementation asks the compiler to scan source files for module dependencies during the build, collates scanning results to infer ordering constraints, and tells the build tool how to dynamically update the build graph.
Whether or not sources get scanned for C++ module usage is dependent on the following queries. The first query that provides a yes/no answer is used.
Note that any scanned source will be excluded from any unity build (see UNITY_BUILD) because module-related statements can only happen at one place within a C++ translation unit.
Compilers which CMake natively supports module dependency scanning include:
The list of generators which support scanning sources for C++ modules include:
There are a number of known limitations of the current C++ module support in CMake. This does not document known limitations or bugs in compilers as these can change over time.
For all generators:
For the Ninja Generators:
For the Visual Studio Generators:
2000-2024 Kitware, Inc. and Contributors
April 15, 2024 | 3.28.3 |