microsoft / microsoft/vscode-cmake-tools

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

Open
#3,079 3 comments 1 reaction 0 assignees View on GitHub
bug Feature: kits Feature: presets
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### 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:

- when running locally, I have to close all vscode windows, then launch it from within a terminal window that has the developer environment variables set. (I wrap `Enter-VsDevShell` with this https://gitlab.freedesktop.org/ryan.pavlik/powershell-enter-vsdevenv so I can get to it quicker, but it's still a pain)
- When running over SSH using the official Remote SSH extension into a Windows machine, since I do not have system environment variables set to include the MSVC developer paths, I cannot use this extension's build support at all, because the presence of CMakePresets.json turns off existing toolchain-finding, and there's no way I know of to call Enter-VsDevShell in the vscode server's shell before it launches.
- As a workaround, I either only build from the embedded terminal manually (where I can call Enter-VsDevShell), or I simply delete the presets file so I can get the old Kits behavior back.

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_

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported cases with CMakePresets.json on local Windows and through Remote/SSH, with and without an MSVC developer environment. Read the CMake Tools handling for presets and kits, then define how a kit environment should be applied; done means preset-based builds can use MSVC locally and over SSH without deleting the presets file.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.