Vscode-cmake-tools: Support preset files for CMake 3.19

Created on 2 Sep 2018  路  10Comments  路  Source: microsoft/vscode-cmake-tools

For portability and easier configurability it would be great if the extensions supports an external configuration file like CMakeSettings.json. If it employs the same format this will enable easy switching between VS Code and VS2017. Also CMakeSettings.json can be committed to a version control system as it is a portable configuration file.

Feature Request configure vs integration fixed (release pending)

Most helpful comment

I support this feature request. I work in a very diverse team, with some members on Windows with VS 2019, others on Linux with VS Code. Having both IDE use the same CMakeSettings.json would be great. It would help with cross-platform compatibility, since both Windows (VisualStudio 2019) and Linux (VS Code) would compile the code with the same configurations and we would have only one file to maintain.

All 10 comments

Thanks for the suggestion! I'll take a look.

Are there any updates on this?

I support this feature request. I work in a very diverse team, with some members on Windows with VS 2019, others on Linux with VS Code. Having both IDE use the same CMakeSettings.json would be great. It would help with cross-platform compatibility, since both Windows (VisualStudio 2019) and Linux (VS Code) would compile the code with the same configurations and we would have only one file to maintain.

I have an additional proposal to this:
It should be possible to tie a build configuration defined in CMakeSettings.jsonto a specific launch configuration defined in launch.vs.json.

Just to voice my annoying opinion again. I had just to setup a few CMake variables via the settings UI. It is annoying, wasn't very easy to find and it definitely was buggy. Maybe it would make sense to have a separate UI for setting CMake arguments but CMakeSettings.json support would be even better to support different configurations with different/conflicting settings.
It is not obvious what should one do if there need to be different arguments set for the different build configurations, without the need to change them each and every time.

Is the concept of CMake Variants cmake-tools' way of implementing a mechanism similar to CMakeSettings.json? Or are variants quite different?

I see this issue is now "On Deck" 馃槃
Looking forward to it!

Note that CMake 3.19 is adding an alternative to CMakeSettings.json as an official part of CMake itself, see https://gitlab.kitware.com/cmake/cmake/-/issues/21164

Comments on that issue indicate that VS proper is planning to move to supporting the new CMakePresets.json designed in that issue as a replacement for CMakeSettings.json. It hence probably makes sense to skip adding anything for the extant VS file format and just support the new format.

The new format is also being documented in CMake as a suggested IDE/tools integration point, as per https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5298

@seanmiddleditch Thanks for making this point! It makes a perfect sense!

CMake Tools 1.7.0 was released today and it contains support for this feature. Upgrade the extension in VSCode and let us know if you encounter any problems.

Was this page helpful?
0 / 5 - 0 ratings