# Empty variable CMAKE\_CXX\_COMPILER\_IMPORT\_STD

**URL:** https://discourse.cmake.org/t/empty-variable-cmake-cxx-compiler-import-std/13918
**Category:** Development
**Created:** [April 11, 2025, 7:33pm UTC](https://discourse.cmake.org/t/empty-variable-cmake-cxx-compiler-import-std/13918 "2025-04-11T19:33:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Timothy\_Madden](https://discourse.cmake.org/user_avatar/discourse.cmake.org/timothy_madden/32/4211_2.png) [@Timothy\_Madden](https://discourse.cmake.org/u/Timothy_Madden)
#### Post date: [April 11, 2025, 7:33pm UTC](https://discourse.cmake.org/t/empty-variable-cmake-cxx-compiler-import-std/13918/1 "2025-04-11T19:33:35Z")

</div>

Hello

I am trying to use “import std;” with C++ modules. I have enabled the experimental feature, and I have followed all the instructions. The feature is working if I open my project directory in Visual Studio, and I let Visual Studio run cmake for me.

The problem shows up if I run `cmake` manually.

`cmake` shows me it still uses Visual Studio:

```auto
C:\Users\Adrian\Projects\ODBC-Client>cmake -B buuild -S .
-- Building for: Visual Studio 17 2022
-- Setting build type to 'Debug'
-- Setting experimental support for CXX_IMPORT_STD
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.43.34810.0
-- The CXX compiler identification is MSVC 19.43.34810.0

```

But then the [CMAKE\_CXX\_COMPILER\_IMPORT\_STD](https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_COMPILER_IMPORT_STD.html#variable:CMAKE_CXX_COMPILER_IMPORT_STD) variable is all empty, indicating I do not have support for “import std;” for my C++ modules.

The difference when running under Visual Studio is that VS passes a rich command line to `cmake`, including the direct path to the compiler (also it selects the Ninja generator):

```auto
1> CMake generation started for configuration: 'x64-Debug'.
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\Program Files\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="D:\UserStorage\Adrian\Projects\ODBC-Client\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "D:\UserStorage\Adrian\Projects\ODBC-Client" 2>&1"
1> Working directory: D:\UserStorage\Adrian\Projects\ODBC-Client\out\build\x64-Debug

```

But really it should be the same compiler, so can cmake please populate the [CMAKE\_CXX\_COMPILER\_IMPORT\_STD](https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_COMPILER_IMPORT_STD.html#variable:CMAKE_CXX_COMPILER_IMPORT_STD) variable in both these cases ?

It’s just breaking my build and forcing me to open Visual Studio to be able to builld my project with `cmake`…

I have the latest versions of cmake 4.0.1 and VS 17.13.6 2022

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 21, 2025, 9:54am UTC](https://discourse.cmake.org/t/empty-variable-cmake-cxx-compiler-import-std/13918/2 "2025-04-21T09:54:53Z")

</div>

The Visual Studio generator does not yet support using modules from outside of the current project, so `import std` isn’t available there yet. You can select the `Ninja` generator from the command line using `-G Ninja`.
