vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Improve automatic setup of MSVC dev environment with presets

Open sinemakinci1 opened this issue 1 year ago • 1 comments

Brief Issue Summary

Feedback from Customers:

There should be better feedback about automatic setup of MSVC dev environment with presets. It took me a long time to figure out that I needed to set CMAKE_CXX_COMPILER to cl.exe explicitly in my CMakePresets.json for it to work. Since this is not needed for typical command line / CI workflows where you set up the environment manually (and rely on CMake to correctly guess that you want to compile with MSVC), some help from IDE is desirable here.

From what I can tell, Visual Studio and even JetBrains CLion do not need "CMAKE_CXX_COMPILER": "cl" as an explicit hint in the preset to provide the MSVC environment setup, just the toolset/architecture keys are enough.

Would it be possible to drop this requirement in cmake-tools, reducing friction with presets authored by/for other tools/IDEs?

CMake Tools Diagnostics


Debug Log


Additional Information

No response

sinemakinci1 avatar Jan 03 '25 21:01 sinemakinci1

I'd like to support this request.

We are having problems with such a definition of CMAKE_CXX_COMPILER if we automate its definition for the different compilers, such as clang for Android, as in those cases the underlying toolchain like the android toolchain.cmake does define its own compiler, different from the clang defined in the presets, and as that is the value cached, posterior calls using the presets will define a different value and it will crash.

It seems reasonable to align with other IDEs and do not require such definition.

memsharded avatar May 09 '25 12:05 memsharded