import std; in cmake 3.30

I’m trying to follow the information mentioned about importing std using MSVC but I get the following error during project generation:

-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22000.
-- The CXX compiler identification is MSVC 19.40.33808.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin
/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (21.1s)
CMake Error in CMakeLists.txt:
  The "CXX_MODULE_STD" property on the target "hellostd" requires that the
  "__CMAKE::CXX23" target exist, but it was not provided by the toolchain.
  Reason:

    Unsupported generator: Visual Studio 17 2022

Any clues ? I’ve updated Visual Studio to the latest version already.

The Visual Studio generator is not supported yet; you’ll need to use the Ninja generator.

1 Like

Thank you.

Is it still true? According to cmake-cxxmodules(7) — CMake 3.30.4 Documentation this should be supported but I have the same version issue despite using cmake 3.30.4 and msvc v194.