# \`\`import std\`\` doesn't work on windows

**URL:** https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268
**Category:** Usage
**Tags:** os:windows, gen:ninja
**Created:** [June 20, 2025, 8:57am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268 "2025-06-20T08:57:25Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 20, 2025, 8:57am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/1 "2025-06-20T08:57:25Z")

</div>

Currently, `import std` doesn’t work on Windows. It fails both in a pure Visual Studio environment (using the CMake and Clang provided by Visual Studio) and with the latest versions of LLVM and CMake built from source. I’ve opened an issue about this, but it seems to be ignored—similar problems were reported over a year ago with no resolution.

If anyone can look into this, it would be greatly appreciated. It’s incredibly frustrating to see this still broken after so many promising conference talks.

* * *

This compiles on WSL

```auto
cmake_minimum_required(VERSION 4.0.3)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
set(CMAKE_CXX_MODULE_STD ON)
set(CXXFLAGS "-stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CXXFLAGS}")
set(CMAKE_CXX_COMPILER clang++)

project("example"
  LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS ON)

add_executable(main main.cpp)

```

This doesn’t compile on Windows

```auto
cmake_minimum_required(VERSION 4.0.3)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
set(CMAKE_CXX_MODULE_STD ON)
set(CXXFLAGS "-stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CXXFLAGS}")
set(CMAKE_CXX_COMPILER C:/dev/toolchains/llvm/bin/clang++.exe)
set(CMAKE_RC_COMPILER C:/dev/toolchains/llvm/bin/llvm-rc.exe)

project("example"
  LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS ON)

add_executable(main main.cpp)

```

```auto
  The "CXX_MODULE_STD" property on the target "main" requires that the
  "__CMAKE::CXX23" target exist, but it was not provided by the toolchain.
  Reason:

    Only `libc++` and `libstdc++` are supported

-- Generating done (0.0s)

```

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 20, 2025, 2:05pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/2 "2025-06-20T14:05:12Z")

</div>

> [@mccakit](#):
>
> This compiles on WSL

which WSL and which llvm version is used?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 20, 2025, 2:28pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/3 "2025-06-20T14:28:59Z")

</div>

If you do it right, it works.  
On Windows with `MSVC 19.43.34808.0`, but you need `CMake v4.0.3` and Ninja generator:

```bash
Run export hostSystemName=Windows
MINGW64_NT-10.0-20348
cmake version 4.0.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
1.11.1.git.kitware.jobserver-1
Executing workflow step 1 of 4: configure preset "dev"

CMake Warning (dev) at cmake/prelude.cmake:17 (if):
  uninitialized variable 'CXX'
Call Stack (most recent call first):
  CMakeLists.txt:3 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/WindowsToolchain/Windows.MSVC.toolchain.cmake:212 (set):
  uninitialized variable 'CMAKE_C_FLAGS_INIT'
Call Stack (most recent call first):
  C:/hostedtoolcache/windows/Python/3.13.3/x64/Lib/site-packages/cmake/data/share/cmake-4.0/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:5 (project)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/WindowsToolchain/Windows.MSVC.toolchain.cmake:212 (set):
  uninitialized variable 'CMAKE_CXX_FLAGS_INIT'
Call Stack (most recent call first):
  C:/hostedtoolcache/windows/Python/3.13.3/x64/Lib/site-packages/cmake/data/share/cmake-4.0/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:5 (project)
This warning is for project developers. Use -Wno-dev to suppress it.

-- The CXX compiler identification is MSVC 19.43.34808.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
CMake Warning (dev) at C:/hostedtoolcache/windows/Python/3.13.3/x64/Lib/site-packages/cmake/data/share/cmake-4.0/Modules/Compiler/CMakeCommonCompilerMacros.cmake:248 (cmake_language):
  CMake's support for `import std;` in C++23 and newer is experimental. It
  is meant only for experimentation and feedback to CMake developers.
Call Stack (most recent call first):
  C:/hostedtoolcache/windows/Python/3.13.3/x64/Lib/site-packages/cmake/data/share/cmake-4.0/Modules/CMakeDetermineCompilerSupport.cmake:113 (cmake_create_cxx_import_std)
  C:/hostedtoolcache/windows/Python/3.13.3/x64/Lib/site-packages/cmake/data/share/cmake-4.0/Modules/CMakeTestCXXCompiler.cmake:83 (CMAKE_DETERMINE_COMPILER_SUPPORT)
  CMakeLists.txt:5 (project)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Detecting CXX compile features - done
-- CMAKE_CXX_COMPILER_IMPORT_STD=23
-- CMAKE_CXX_MODULE_STD=ON
-- ALGO_USE_MODULES=TRUE
-- CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Configuring done (6.4s)
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_MCSS_DOCS
    cmake-init-modules_DEVELOPER_MODE

-- Generating done (0.0s)
-- Build files have been written to: D:/a/cmake-init-modules/cmake-init-modules/build/dev

Executing workflow step 2 of 4: build preset "dev"

[1/17] Building CXX object CMakeFiles\Algo_verify_interface_header_sets.dir\Algo_verify_interface_header_sets\algo_export.h.cxx.obj
[2/17] Scanning D:\a\cmake-init-modules\cmake-init-modules\algo-interface.cppm for CXX dependencies
algo-interface.cppm
[3/17] Scanning "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\modules\std.compat.ixx" for CXX dependencies
std.compat.ixx
[4/17] Scanning D:\a\cmake-init-modules\cmake-init-modules\example\main.cpp for CXX dependencies
[5/17] Scanning D:\a\cmake-init-modules\cmake-init-modules\algo-impl.cpp for CXX dependencies
[6/17] Scanning "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\modules\std.ixx" for CXX dependencies
std.ixx
[7/17] Generating CXX dyndep file CMakeFiles\__cmake_cxx23.dir\CXX.dd
[8/17] Generating CXX dyndep file CMakeFiles\Algo.dir\CXX.dd
[9/17] Generating CXX dyndep file example\CMakeFiles\app.dir\CXX.dd
[10/17] Building CXX object CMakeFiles\__cmake_cxx23.dir\C_\Program_Files\Microsoft_Visual_Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\modules\std.ixx.obj
std.ixx
[11/17] Building CXX object CMakeFiles\__cmake_cxx23.dir\C_\Program_Files\Microsoft_Visual_Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\modules\std.compat.ixx.obj
std.compat.ixx
[12/17] Linking CXX static library __cmake_cxx23.lib
[13/17] Building CXX object CMakeFiles\Algo.dir\algo-interface.cppm.obj
algo-interface.cppm
D:\a\cmake-init-modules\cmake-init-modules\algo-interface.cppm(6): warning C5202: a global module fragment can only contain preprocessor directives
[14/17] Building CXX object example\CMakeFiles\app.dir\main.cpp.obj
[15/17] Building CXX object CMakeFiles\Algo.dir\algo-impl.cpp.obj
[16/17] Linking CXX shared library stagedir\bin\Algo.dll
[17/17] Linking CXX executable stagedir\bin\app.exe

Executing workflow step 3 of 4: test preset "dev"

Test project D:/a/cmake-init-modules/cmake-init-modules/build/dev
    Start 1: app-tests
    Start 2: install-to-stagedir
    Start 3: find-package-test
1/3 Test #1: app-tests ........................ Passed 0.01 sec
2/3 Test #2: install-to-stagedir .............. Passed 0.02 sec
3/3 Test #3: find-package-test ................ Passed 5.11 sec

100% tests passed, 0 tests failed out of 3

Total Test time (real) = 5.12 sec

Executing workflow step 4 of 4: package preset "dev"

CPack: Create package using TGZ
CPack: Install projects
CPack: - Install project: my_package [Debug]
CPack: Create package
CPack: - package: D:/a/cmake-init-modules/cmake-init-modules/build/dev/my_package-0.2.0-win64.tar.gz generated.

```

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 20, 2025, 2:46pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/4 "2025-06-20T14:46:39Z")

</div>

Ubuntu, CMake 4.0.3, Clang 18.1.3

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 20, 2025, 2:48pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/5 "2025-06-20T14:48:02Z")

</div>

I do have CMake 4.0.3, what do you mean by doing it right?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 20, 2025, 3:10pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/6 "2025-06-20T15:10:23Z")

</div>

see [How to test for CXX module availability - #2 by ClausKlein](https://discourse.cmake.org/t/how-to-test-for-cxx-module-availability/14266/2)

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 20, 2025, 3:43pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/7 "2025-06-20T15:43:48Z")

</div>

I don’t know why you are pointing me to this, I have my llvm ```built from source`` with libc++ installed, I can use libc++ to cross compile to 6 platforms I just can’t use std lib modules

Either the build system is bugged, or my build system configuration is wrong.  
My build system configuration can’t be wrong because I can use it to `import std` on WSL.

If my toolchain were buggy, than I wouldn’t have this issue on Android NDK and Emscripten as well.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 20, 2025, 4:32pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/8 "2025-06-20T16:32:43Z")

</div>

### Then you need to analyse first what goes wrong within your build environment!

see i.e.: [No SOURCES given to target: \_\_CMAKE\_\_CXX26 on ubuntu 25.04 - #6 by ClausKlein](https://discourse.cmake.org/t/no-sources-given-to-target-cmake-cxx26-on-ubuntu-25-04/14240/6)

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 20, 2025, 4:53pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/9 "2025-06-20T16:53:16Z")

</div>

Well, I read that and wanna say this:  
I’m not doing anything exceptional. I’m just trying to build a simple hello world with import std but these combinations fail

- CMake compiled from source + llvm compiled from source
- CMake 4.0.3 + LLVM install by scoop
- CMake 4.0.2 + Android NDK
- CMake 4.0.2 + EMSDK
- CMake 3.31.6 + Visual Studio Clang
- CMake 3.31.7 + LLVM compiled from source

All use correct UUID’s of course, I can’t be at fault here, It is just not possible.  
Before posting here I did these

- I posted on discord
- I created an issue on Gitlab
- I tried using different build systems(xmake works)

CMake here is at fault, there is no doubt.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 20, 2025, 5:45pm UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/10 "2025-06-20T17:45:49Z")

</div>

what is the output of `clang++-20 -print-file-name=libc++.modules.json` ?

And check the result of

```bash
CXX=clang++-20 cmake -G Ninja -S . -B build --fresh --trace-expand --trace-source=Clang-CXX-CXXImportStd.cmake

```

And delete this lines, you must set the your path to `C:/dev/toolchains/llvm/bin/`!

> [@mccakit](#):
>
> ```auto
> set(CMAKE_CXX_COMPILER C:/dev/toolchains/llvm/bin/clang++.exe)
> set(CMAKE_RC_COMPILER C:/dev/toolchains/llvm/bin/llvm-rc.exe)
> 
> ```

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 7:02am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/11 "2025-06-21T07:02:17Z")

</div>

./clang++ -print-file-name=libc++.modules.json  
libc++

I doubt that will make much difference, I already have the entire bin folder at PATH

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 7:32am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/12 "2025-06-21T07:32:02Z")

</div>

> [@mccakit](#):
>
> clang++ -print-file-name=libc++.modules.json

### CMake needs the full path to the json file!

```bash
bash-5.2$ pwd
/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules

bash-5.2$ clang++ -print-file-name=libc++.modules.json
libc++.modules.json
bash-5.2$ clang++ -print-file-name=c++/libc++.modules.json
/usr/local/Cellar/llvm/20.1.6/lib/clang/20/../../c++/libc++.modules.json

bash-5.2$ g++-15 -print-file-name=c++/libc++.modules.json
c++/libc++.modules.json
bash-5.2$ g++-15 -print-file-name=libc++.modules.json
libc++.modules.json
bash-5.2$ g++-15 -print-file-name=libstdc++.modules.json
/usr/local/Cellar/gcc/15.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin23/15/../../../libstdc++.modules.json
bash-5.2$ 

```

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 7:41am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/13 "2025-06-21T07:41:39Z")

</div>

Can you give me something practical?  
libc++.modules.json is at C:\dev\toolchains\llvm\lib\libc++.modules.json

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 8:20am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/14 "2025-06-21T08:20:30Z")

</div>

### No!

I pointed you to all Information you need to find the problem yourself

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 8:28am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/15 "2025-06-21T08:28:22Z")

</div>

Dude, you didn’t gave me any useful info at all, I can’t work with this, tell me that I have to point to libc++ config by setting a variable or smith like that, stuff I can try out

You just pass me test results and expect me to fix this problem.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 8:34am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/16 "2025-06-21T08:34:05Z")

</div>

> [@ClausKlein](#):
>
> CMake needs the full path to the json file!

Check it🙋‍♂️

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 9:24am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/17 "2025-06-21T09:24:14Z")

</div>

> [@ClausKlein](#):
>
> And check the result of
> 
> ```auto
> CXX=clang++-20 cmake -G Ninja -S . -B build --fresh --trace-expand --trace-source=Clang-CXX-CXXImportStd.cmake
> 
> ```

Dit you?🫢

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 9:38am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/18 "2025-06-21T09:38:14Z")

</div>

> [@ClausKlein](#):
>
> `CXX=clang++-20 cmake -G Ninja -S . -B build --fresh --trace-expand --trace-source=Clang-CXX-CXXImportStd.cmake`

I did, and by removing CMAKE\_CXX\_COMPILER and setting the path, like you asked

```auto
PS C:\Users\cakit\Desktop\std> $env:CXX = "clang++"
PS C:\Users\cakit\Desktop\std> cmake -G Ninja -S . -B build --fresh --trace-expand --trace-source=Clang-CXX-CXXImportStd.cmake
Put cmake in trace mode, but with variables expanded.
Put cmake in trace mode, but output only lines of a specified file. Multiple options are allowed.
-- The CXX compiler identification is Clang 21.0.0 with GNU-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/dev/toolchains/llvm/bin/clang++.exe - skipped
-- Detecting CXX compile features
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(1): function(_cmake_cxx_import_std std variable )
CMake Warning (dev) at C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/CMakeCommonCompilerMacros.cmake:248 (cmake_language):
  CMake's support for `import std;` in C++23 and newer is experimental. It
  is meant only for experimentation and feedback to CMake developers.
Call Stack (most recent call first):
  C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/CMakeDetermineCompilerSupport.cmake:113 (cmake_create_cxx_import_std)
  C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/CMakeTestCXXCompiler.cmake:83 (CMAKE_DETERMINE_COMPILER_SUPPORT)
  CMakeLists.txt:7 (project)
This warning is for project developers. Use -Wno-dev to suppress it.

C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(2): if(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libc++ )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(4): elseif(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libstdc++ )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(6): else()
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(7): set(target_definition set(CMAKE_CXX23_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE "Only `libc++` and `libstdc++` are supported")
 PARENT_SCOPE )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(10): return()
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(1): function(_cmake_cxx_import_std std variable )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(2): if(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libc++ )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(4): elseif(CMAKE_CXX_STANDARD_LIBRARY STREQUAL libstdc++ )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(6): else()
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(7): set(target_definition set(CMAKE_CXX26_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE "Only `libc++` and `libstdc++` are supported")
 PARENT_SCOPE )
C:/Users/cakit/scoop/apps/cmake/current/share/cmake-4.0/Modules/Compiler/Clang-CXX-CXXImportStd.cmake(10): return()
-- Detecting CXX compile features - done
-- Configuring done (1.9s)
CMake Error in CMakeLists.txt:
  The "CXX_MODULE_STD" property on the target "main" requires that the
  "__CMAKE::CXX23" target exist, but it was not provided by the toolchain.
  Reason:

    Only `libc++` and `libstdc++` are supported

-- Generating done (0.0s)
CMake Generate step failed. Build files cannot be regenerated correctly.

```

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 21, 2025, 9:56am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/19 "2025-06-21T09:56:07Z")

</div>

so read

- [No SOURCES given to target: \_\_CMAKE\_\_CXX26 on ubuntu 25.04 - #10 by ben.boeckel](https://discourse.cmake.org/t/no-sources-given-to-target-cmake-cxx26-on-ubuntu-25-04/14240/10)
- [No SOURCES given to target: \_\_CMAKE\_\_CXX26 on ubuntu 25.04 - #12 by ClausKlein](https://discourse.cmake.org/t/no-sources-given-to-target-cmake-cxx26-on-ubuntu-25-04/14240/12)

---

<div class="post-metadata">

### Author: ![mccakit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mccakit/32/5628_2.png) [@mccakit](https://discourse.cmake.org/u/mccakit)
#### Post date: [June 21, 2025, 10:12am UTC](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268/20 "2025-06-21T10:12:00Z")

</div>

Setting enviroment variables CXX and CXXFLAGS doesn’t solve my issue, here is the log.  
[log.txt](https://discourse.cmake.org/uploads/short-url/3UchRqYBK3i27U3Y5gXDKOmqqVu.txt) (163.4 KB)

[Next page](https://discourse.cmake.org/t/import-std-doesnt-work-on-windows/14268.md?page=2)
