Visual Studio 2017 15.7 Preview 4 is now available and we have added a few more CMake features in addition to the Targets View and single file compilation added in Preview 3. We keep the version of CMake that ships with Visual Studio as fresh as possible, so we have updated it to version 3.11. We are also excited to announce that CMake projects now support the IDE’s code analysis features that previously required a VCXProj to take advantage of.
Please download the preview and check out the latest CMake features such as the Targets View, single file compilation, and more control over when projects are configured. As always, we would love to hear your feedback too.
If you are new to CMake in Visual Studio, check out how to get started.
Code Analysis for CMake Projects
In the latest preview, you can now run Visual Studio’s comprehensive code analysis tools on CMake projects. Currently, you can run code analysis at the target level. Options to run code analysis for single files or your entire project are coming soon.
To run code analysis on a CMake target you can select “Run Code Analysis” from the CMake menu:
Or, if you are using the Targets View you can simply right click on any target and select “Run Code Analysis:”
Any analysis errors or warnings that are detected will appear in the Output Window:
By default CMake projects use the “Microsoft Native Recommended Rules” rule set, but you can change this by modifying your CMakeSettings.json file. Just add the “codeAnalysisRuleset” tag to your configuration with the name or path to a rule set file.
To ensure that your projects can take advantage of the latest and greatest CMake features we have upgraded the version of CMake that ships with Visual Studio from 3.10 to 3.11. You can find the full lists of enhancements to CMake 3.11 in the CMake 3.11 release notes.
Send Us Feedback
Your feedback is a critical part of ensuring that we can deliver the best CMake experience. We would love to know how Visual Studio 2017 Preview is working for you. If you have any feedback specific to CMake Tools, please reach out to email@example.com. For general issues please Report a Problem.