{"id":15875,"date":"2017-05-10T12:00:12","date_gmt":"2017-05-10T19:00:12","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=15875"},"modified":"2019-02-18T17:48:30","modified_gmt":"2019-02-18T17:48:30","slug":"cmake-support-in-visual-studio-whats-new-in-2017-15-3-update","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/cmake-support-in-visual-studio-whats-new-in-2017-15-3-update\/","title":{"rendered":"CMake support in Visual Studio \u2013 what\u2019s new in 2017 15.3 Preview"},"content":{"rendered":"<p style=\"text-align: left\">We are excited to announce the first preview release of <a href=\"https:\/\/www.visualstudio.com\/vs\/preview\/\">Visual Studio 2017 15.3 update<\/a> in conjunction with our <a href=\"https:\/\/build.microsoft.com\/\">Build 2017<\/a> conference!\u00a0 This preview includes two new features of interest to developers utilizing CMake.\u00a0 Support for the CMake Ninja generator and CMake CTest integration in the IDE.<\/p>\n<p>Please download the preview and try out the latest CMake features.\u00a0 If you are just getting started with CMake, follow the link to\u00a0<a href=\"https:\/\/aka.ms\/cmake\">learn more about CMake support in Visual Studio<\/a>.\u00a0 We are looking forward to your feedback.<\/p>\n<h3>Build with Ninja<\/h3>\n<p>You asked for support for more CMake build generators and we listened. \u00a0The latest preview of the CMake tools for Visual Studio now support the <a href=\"https:\/\/ninja-build.org\/\">Ninja build system<\/a>.\u00a0 Keep in mind, this is a preview so there are a few limitations.\u00a0 The CMake tools for Visual Studio currently only support building for x86 and are not compatible with CTest.\u00a0 In addition, Ninja builds are currently only supported on 64-bit OSes.\u00a0 Don\u2019t worry though, these limitations will be resolved by the time 15.3 hits the public channel.<\/p>\n<p>To get started with the Ninja generator, you will need to edit your CMakeSettings.json file.\u00a0 Right click on your CMakeLists.txt file and select \u201c<strong>Change CMake Settings<\/strong>\u201d to navigate to or create this file if you don\u2019t already have one in your folder:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/Edit-CMake-Settings.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/Edit-CMake-Settings.png\" alt=\"Edit CMake Settings\" width=\"360\" height=\"486\" class=\"size-full wp-image-15885 aligncenter\" \/><\/a><\/p>\n<p>If you haven\u2019t added a CMakeSettings.json file to your folder yet, you will see something like this:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/CMake-Settings-JSON.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/CMake-Settings-JSON.png\" alt=\"CMake Settings JSON\" width=\"622\" height=\"731\" class=\"size-full wp-image-15895 aligncenter\" \/><\/a><\/p>\n<p>You can choose the Ninja generator by setting the \u201cgenerator\u201d tag of each configuration you want to build using Ninja.\u00a0 If you have an existing CMakeSettings.json file you will need to update the generator from \u201cVisual Studio 15 2017\u201d to \u201cNinja\u201d.\u00a0 Keep in mind, there isn\u2019t support yet for x64 configurations.<\/p>\n<p>The Ninja generator is selected by default for x86 builds in the preview releases of 15.3, but this will be changing once it is released to the public channel.<\/p>\n<h3>CTest Integration<\/h3>\n<p>New generators are great, but it is also important for developers to be assured of the quality of their code.\u00a0 The preferred way to do this with CMake projects is to use <a href=\"https:\/\/cmake.org\/Wiki\/CMake\/Testing_With_CTest\">CTest<\/a>.\u00a0 The good news, if you are already using CTest, you don\u2019t need to do anything.\u00a0 The latest preview of Visual Studio should detect the tests without any intervention on your part.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/CTest-Run-Tests.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/CTest-Run-Tests.png\" alt=\"CTest Run Tests\" width=\"243\" height=\"252\" class=\"size-full wp-image-15905 aligncenter\" \/><\/a><\/p>\n<p><em>If you don\u2019t see the \u201c<strong>Run Tests<\/strong>\u201d menu item, make sure you are using the Visual Studio CMake generator in your CMakeSettings.json file.\u00a0 This limitation will be resolved in a future release.<\/em><\/p>\n<p>Once you select \u201c<strong>Run Tests<\/strong>\u201d from the CMake menu or by right clicking on your CMakeLists.txt file, your project will be automatically built, and your tests will run. The output is streamed to the CMake Output window \u2013 CTest is not yet integrated with the Test Explorer.<\/p>\n<h3>Send us Feedback<\/h3>\n<p>To try out the latest and greatest CMake features and give us some early feedback, please download and install the latest\u00a0<a href=\"https:\/\/www.visualstudio.com\/vs\/preview\/\">Visual Studio 2017 Preview<\/a>.\u00a0 As always, we welcome your feedback.\u00a0 Feel free to send any comments through e-mail at\u00a0<a href=\"mailto:cmake@microsoft.com\">cmake@microsoft.com<\/a>, through\u00a0<a href=\"https:\/\/twitter.com\/visualc\">Twitter @visualc<\/a>, or Facebook at\u00a0<a href=\"https:\/\/www.facebook.com\/Microsoft-Visual-Cpp-222043184527264\/\">Microsoft Visual Cpp<\/a>.<\/p>\n<p>If you encounter other problems with Visual Studio 2017 please let us know via\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017\">Report a Problem<\/a>, which is available in both the installer and the IDE itself. \u00a0For suggestions, let us know through\u00a0<a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-2015\/category\/30937-languages-c\">UserVoice<\/a>. We look forward to your feedback!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce the first preview release of Visual Studio 2017 15.3 update in conjunction with our Build 2017 conference!\u00a0 This preview includes two new features of interest to developers utilizing CMake.\u00a0 Support for the CMake Ninja generator and CMake CTest integration in the IDE. Please download the preview and try out the [&hellip;]<\/p>\n","protected":false},"author":326,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[266],"tags":[8,140,252,233,308,6,309,268,185],"class_list":["post-15875","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cmake","tag-announcement","tag-c","tag-cmake","tag-cross-platform","tag-existing-code","tag-ide","tag-import","tag-openfolder","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>We are excited to announce the first preview release of Visual Studio 2017 15.3 update in conjunction with our Build 2017 conference!\u00a0 This preview includes two new features of interest to developers utilizing CMake.\u00a0 Support for the CMake Ninja generator and CMake CTest integration in the IDE. Please download the preview and try out the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/15875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/326"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=15875"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/15875\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=15875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=15875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=15875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}