CXX_MODULE_STD — CMake 3.31.1 Documentation

# CXX_MODULE_STD

Added in version 3.30.

`CXX_MODULE_STD` is a boolean specifying whether the target may use `import std;` its C++ sources or not.

Note

This setting is meaningful only when experimental support for `import std;` has been enabled by the `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` gate.

When this property is explicitly set to `ON`, CMake will add a dependency to a target which provides the C++ standard library's modules for the C++ standard applied to the target. This target is only applicable within the current build and will not appear in the exported interfaces of the targets. When consumed, these targets will be reapplied as necessary.

This property's value is not relevant for targets which disable scanning (see `CXX_SCAN_FOR_MODULES`). Additionally, this property only applies to targets utilizing C++23 (`cxx_std_23`) or newer.

The property supports `generator expressions`, however expressions that depend upon the configuration, the consuming target, or the linker language are not allowed. Whether a target uses `import std` should not depend upon such things as it is a static property of the target's source code.

Targets which are exported with C++ module sources will have this property's resolved value exported.