How can I get CMake 4.2.2 to enable support for the experimental feature import std?
08:49 11 Jun 2026

My top-level CMakeLists.txt starts with

cmake_minimum_required(VERSION 4.2.2)

# Enable experimental import std support
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")

project(... LANGUAGES CXX C)

The value used matches the one that should be used for the version of CMake I'm using

Running CMake with a --version flag outputs

cmake version 4.2.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Still, I get the error that the experimental feature was not enabled when trying to use the property CXX_MODULE_STD on a target:

CMake Error in .../CMakeLists.txt:
  The "CXX_MODULE_STD" property on the target "channel_emulator_controller"
  requires that the "__CMAKE::CXX23" target exist, but it was not provided by
  the toolchain.  Reason:

    Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled (usually a `project()` call)

Am I missing something?

cmake c++23 c++-modules