microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.43k stars 430 forks source link

CMakePresets don't work with MSVC when using Remote/SSH, and are painful when running locally #3079

Open rpavlik opened 1 year ago

rpavlik commented 1 year ago

Brief Issue Summary

To get presets that are designed for cross-platform projects (so, using ninja generator, etc - I haven't tried using the Visual Studio/vcproj generators because I do not want to use them and never had to use them before Presets) to work:

I think the fundamental problem here is that the kits and CMakePresets are not inherently in conflict, but are treated as such by the extension. It might be OK to default to not setting up kits when you have a presets file, but I want to be able to tell the extension to please set up the environment for a kit before doing what the presets file says. This doesn't matter as much on Linux where there are standard system locations for a toolchain (though I would still like to pick which one), but on Windows with MSVC installed as usual, you can't just run cmake (at least using any non-vcproj generator) from a command line with no advance setup.

This is actively keeping me from using the otherwise nice CMakePresets functionality because it makes developing and contributing to projects on Windows so painful.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

rpavlik commented 1 year ago

Related to this: https://github.com/microsoft/vscode-cmake-tools/issues/2912

Same basic pain point.

gcampbell-msft commented 1 year ago

@rpavlik Thanks for your report.

A clarifying question: You mentioned that "the presence of CMakePresets.json turns off existing toolchain-finding". Are you referencing the finding of toolchains or are you referencing the usage and finding of kits?

Additionally, have you confirmed that MSVC is installed on your Windows remote machine?

Thanks for any information that can help us investigate.

rpavlik commented 1 year ago

Sorry, yes I meant kits. The stuff is definitely installed, I just don't always want to turn sideways to use my windows laptop (bad ergonomics) so I see this when using ssh from my Linux desktop. Works fine without presets files, but put a preset file there and you've got trouble. The project I first noticed this with is https://gitlab.freedesktop.org/monado/monado but any with similar presets files will do it. My colleagues have also seen this and will just delete the presets files to get the original behavior back even when not using ssh. (And I'm blocking merge of presets files in the project root in other projects to avoid this problem.)