[Feature] Allow shell selection for entire CMake Tools infrastructure
Request Overview
Copied from #3526.
There are many open MSYS2/MinGW issues in vscode-cmake-tools which all stem from the same problem: There is no way to select a shell in which CMake Tools runs.
I (and many other) developers prefer to use MSYS2+MinGW or similar over MSVC and native toolchains because it provides a familiar experience for people coming from the Linux or embedded development space where we can rely on the existence of certain builtins, optimisations and features. There's also WSL of course, but I think the approach there is to treat it as a remote development environment (through the cough proprietary cough extension) - besides it doesn't build native Windows executables.
The kit specification feature is quite underpowered at the moment. One can specify compiler locations for example, but there is so much more to a complete development environment than just the frontend language compilers. There's binutils, linkers, library search paths etc. Many of the problems in open issues around Kits stems from this fact - people are trying to point CMake to their "C compiler of choice" while the rest of their environment is completely out of whack. The kit structure encourages people to fall into this trap and it is a bad design decision IMO. Operating systems typically come in "distributions" for a reason. One easy solution to this for the MSYS2 case would be to just allow us to specify which shell the tools run CMake in. You already let us specify a custom "Terminal" which can interact with MSYS2 bash no problem.
Through the MSYSTEM environment variable, you can spin up a MSYS2 shell geared for e.g. MinGW64 development, with the PATH correctly configured to include the prefix at C:\msys64\mingw64\bin and so on.
The current development workflow for someone using MSYS2 currently consists of either: running a terminal emulator and calling cmake manually (with IntelliSense kind of getting the idea most of the time); or specifying a complex and fragile array of variables in cmake-kits.json, CMakePresets.json and settings.json to get the whole thing to work.
Additional Information
No response
people who use cmake in some system steps 1、start shell 2、set some env(vsvar bat or other ) 3、cmake configure & build
cmake-tools do some thing (back ground)like 1、2、3, but no good enough
i also find bug with this step cmake-tools do
https://github.com/microsoft/vscode-cmake-tools/issues/4316