What’s new for C++ cross-platform developers in Visual Studio 2022
Visual Studio 2022 is available now! Check out the video below to learn what’s new for C++ developers who are building for more than just Windows, or who are developing with an eye to open source. This video covers:
- Building with Visual Studio’s CMake Presets integration
- Managing dependencies with a vcpkg manifest file and binary caching
- Editing CMake scripts with CMake in-editor documentation and language services for CMake
- Building and debugging a Linux GUI application on WSL 2 with Visual Studio’s native support for WSL 2
- Reproducing local builds with CMake Presets and GitHub Actions
- Debugging a remote process with LLDB
Have questions or comments about Visual Studio 2022? Want to share feedback with our team? You can contact us at firstname.lastname@example.org or on Twitter (@VisualC). The best way to file a bug or suggest a feature is with the Send Feedback button in the upper right-hand corner of the IDE. See How to report a problem with Visual Studio or Visual Studio Installer for more information.
I’m really glad the VS team is invested in making cross-platform development with CMake more user friendly. Visual Studio is an excellent IDE and CMake is a solid build system.
I have 2 main concerns:
Teaching more and more people how to use CMake. It would be great if Microsoft helped upstream tutorials and documentation to CMake with up to date practices.
The current official CMake tutorial is really bare bones. It would be nice to have a full DX12 tutorial, or something like that. Explaining best practices, and understanding the windows platform.
There are no good top down explains of understanding the MSVC toolchain that I have found anywhere (except at my company where I have written it all down). Most people don’t even know about the resource compiler.
It would be really great for driver development if the WDK received the same level of love as the SDK. Working on drivers we had to write our own custom toolchains to work with the WDK. Which isn’t ideal.
And CMake doesn’t seem to fully support it well either.
Thank you Microsoft for moving in the right direction of supporting cross-platform development.
Still, I’d like to draw some attention to the fact that the way CMake build presets are implemented in Visual Studio is explicitly discouraged by CMake developers. As Erica commented earlier, current approach is to have separate configure presets and build trees for each build preset.
IDEs should avoid creating more build trees than necessary, and only create multiple build trees if the user wishes to switch to a different compiler, use different compile flags, etc. In particular, IDEs should NOT create multiple single-config build trees which all have the same properties except for a differing CMAKE_BUILD_TYPE, effectively creating a multi-config environment. Instead, the Ninja Multi-Config generator, in conjunction with the File API to get the list of build configurations, should be used for this purpose.
That would allow faster switching between deubg/release without relaunching CMake cache generation.
Ninja Multi-Config support suggestion issue haven’t seen any interest from VS developers. Apart from Ninja Multi-Config there is a Visual Studio generator which is multi-config too.
Thanks for the feedback. We are working on multi-config support now, and it will be available in an upcoming preview release of Visual Studio 2022.
Guys please fix suggestions on cmake editor. They either don’t show up or break valid statements.
Thanks you for the CMake support better and better.
I am enjoying it.
I have 3 concerns:
1. In my use of VS, CMakeList.txt file changes will cause the re-generation, parsing and solution tree refreshing.
It may takes long. Would you please optimize it ?
2. New CMake project has only one x64-debug, Would you please add Win/Linux(clang) x86/x64 , totally 4 configuration by default?
3. Would some hot/critical CMake settings(like MTd/MT, static/dynamic etc) can be added to UI setting window?