.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "CMAKE-CXXMODULES" "7" "April 24, 2024" "3.29.2" "CMake" .SH NAME cmake-cxxmodules \- CMake C++ Modules Support Reference .sp New in version 3.28. .sp C++ 20 introduced the concept of \(dqmodules\(dq to the language. The design requires build systems to order compilations among each other to satisfy \fBimport\fP statements reliably. CMake\(aqs 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. .SH SCANNING CONTROL .sp 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. .INDENT 0.0 .IP \(bu 2 If the source file belongs to a file set of type \fBCXX_MODULES\fP, it will be scanned. .IP \(bu 2 If the target does not use at least C++ 20, it will not be scanned. .IP \(bu 2 If the source file is not the language \fBCXX\fP, it will not be scanned. .IP \(bu 2 If the \fI\%CXX_SCAN_FOR_MODULES\fP source file property is set, its value will be used. .IP \(bu 2 If the \fI\%CXX_SCAN_FOR_MODULES\fP target property is set, its value will be used. Set the \fI\%CMAKE_CXX_SCAN_FOR_MODULES\fP variable to initialize this property on all targets as they are created. .IP \(bu 2 Otherwise, the source file will be scanned if the compiler and generator support scanning. See policy \fI\%CMP0155\fP\&. .UNINDENT .sp Note that any scanned source will be excluded from any unity build (see \fI\%UNITY_BUILD\fP) because module\-related statements can only happen at one place within a C++ translation unit. .SH COMPILER SUPPORT .sp Compilers which CMake natively supports module dependency scanning include: .INDENT 0.0 .IP \(bu 2 MSVC toolset 14.34 and newer (provided with Visual Studio 17.4 and newer) .IP \(bu 2 LLVM/Clang 16.0 and newer .IP \(bu 2 GCC 14 (for the in\-development branch, after 2023\-09\-20) and newer .UNINDENT .SH GENERATOR SUPPORT .sp The list of generators which support scanning sources for C++ modules include: .INDENT 0.0 .IP \(bu 2 \fI\%Ninja\fP .IP \(bu 2 \fI\%Ninja Multi\-Config\fP .IP \(bu 2 \fI\%Visual Studio 17 2022\fP .UNINDENT .SS Limitations .sp 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. .sp For all generators: .INDENT 0.0 .IP \(bu 2 Header units are not supported. .IP \(bu 2 No builtin support for \fBimport std;\fP or other compiler\-provided modules. .UNINDENT .sp For the Ninja Generators: .INDENT 0.0 .IP \(bu 2 \fBninja\fP 1.11 or newer is required. .UNINDENT .sp For the \fI\%Visual Studio Generators\fP: .INDENT 0.0 .IP \(bu 2 Only Visual Studio 2022 and MSVC toolsets 14.34 (Visual Studio 17.4) and newer. .IP \(bu 2 No support for exporting or installing BMI or module information. .IP \(bu 2 No support for compiling BMIs from \fBIMPORTED\fP targets with C++ modules. .IP \(bu 2 No diagnosis of using modules provided by \fBPRIVATE\fP sources from \fBPUBLIC\fP module sources. .UNINDENT .SH COPYRIGHT 2000-2024 Kitware, Inc. and Contributors .\" Generated by docutils manpage writer. .