Support for microsoft.com/VisualStudioSettings/CMake/1.0 vendor option in CMakePresets.json
See original GitHub issueBrief Issue Summary
CMakePresets for windows targets using msvc cannot be configured easily as there is no support for the cmakeGenerateCommand vendor option. The only reason this is useful is due to the fact that we must call vcvarsall.bat to load all the required envs to build against msvc. We’ve been achomplishing this through bat files that use vswhere to first locate, then execute the vcvarsall bat file.
Note I am able to use cmake presets in visual studio 2019 preview, and it works great.
The vendor section in question is:
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"cmakeGenerateCommand": "setup.bat Debug"
}
}
I will note that this is in the json schema definition in vscode, however there is no logic to execute it.
So until this is supported I am relying on the cmake-kits/cmake-variants flow as it supports the option ‘environmentSetupScript’
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
CMakeUserPresets.json - Microsoft Learn
The Visual Studio Settings vendor map is supported by both CMakePresets.json and CMakeUserPresets.json . The options in the Visual Studio ...
Read more >Not able to build when using CMakePresets.json
Your open channel to Microsoft engineering teams ... 13 0 1 ... This issue seemed to occur after I had adding...
Read more >An Introduction to CMakePresets.json - YouTube
Check out free documentation and modules on Microsoft Learn: https://docs. microsoft.com/en-us/cpp/?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@esweet431, some thoughts to think about from the last comment.
I think if we could add a vendor option that works just like the cmake-kits option ‘environmentSetupScript’, then that’d be a complete solution, as for example I could run a script like so to automatically, and generically, setup the proper build env prior to cmake config:
Then I could use CMakePresets, although this would ideally be handled by something within cmake I suppose as otherwise the only use case that would work would be an interactive vscode dev environment. When we really need something that can work purely with cmake for CI/Pipeline scripting.
As far as doing this all in a toolchain, yeah thats possible but simply not really easy to do and fairly confusing, but I get why that would be the recommended approach.
Bottom line is, everyone who develops on windows has this hurdle with vcvars, and as much as everyone likes to declare ‘its out of scope for our particular component’, everyone still suffers and everyone still is writing additional tooling to work around it.
Having this built into cmake would be just awesome, like native vcvars loading and detection etc.