cmake-cxxmodules.7.rst 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .. cmake-manual-description: CMake C++ Modules Support Reference
  2. cmake-cxxmodules(7)
  3. *******************
  4. .. versionadded:: 3.28
  5. C++ 20 introduced the concept of "modules" to the language. The design
  6. requires build systems to order compilations among each other to satisfy
  7. ``import`` statements reliably. CMake's implementation asks the compiler
  8. to scan source files for module dependencies during the build, collates
  9. scanning results to infer ordering constraints, and tells the build tool
  10. how to dynamically update the build graph.
  11. Compiler Support
  12. ================
  13. Compilers which CMake natively supports module dependency scanning include:
  14. * MSVC toolset 14.34 and newer (provided with Visual Studio 17.4 and newer)
  15. * LLVM/Clang 16.0 and newer
  16. * GCC 14 (for the in-development branch, after 2023-09-20) and newer
  17. Generator Support
  18. =================
  19. The list of generators which support scanning sources for C++ modules include:
  20. - :generator:`Ninja`
  21. - :generator:`Ninja Multi-Config`
  22. - :generator:`Visual Studio 17 2022`
  23. Limitations
  24. -----------
  25. There are a number of known limitations of the current C++ module support in
  26. CMake. This does not document known limitations or bugs in compilers as these
  27. can change over time.
  28. For all generators:
  29. - Header units are not supported.
  30. - No builtin support for ``import std;`` or other compiler-provided modules.
  31. For the Ninja Generators:
  32. - ``ninja`` 1.11 or newer is required.
  33. For the :ref:`Visual Studio Generators`:
  34. - Only Visual Studio 2022 and MSVC toolsets 14.34 (Visual Studio
  35. 17.4) and newer.
  36. - No support for exporting or installing BMI or module information.
  37. - No diagnosis of using modules provided by ``PRIVATE`` sources from
  38. ``PUBLIC`` module sources.