{"id":30616,"date":"2022-06-15T15:52:57","date_gmt":"2022-06-15T15:52:57","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=30616"},"modified":"2022-06-15T15:52:57","modified_gmt":"2022-06-15T15:52:57","slug":"whats-new-in-cmake-for-vs-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/whats-new-in-cmake-for-vs-code\/","title":{"rendered":"What&#8217;s New in CMake for VS Code"},"content":{"rendered":"<p><span data-contrast=\"auto\">The latest version of CMake tools is now <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/releases\/tag\/v1.11.26\">available for download<\/a> in the VS Code Marketplace or using the .vsix file. We have been working hard on improving the CMake experience and are excited to share some new features and improvements for users starting in version 1.11.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><b><span data-contrast=\"auto\">\u2018CMake\u2019 task provider updates<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">We have added more options to the build task and more commands for the \u201ccmake\u201d task type so you don\u2019t have to manually type up shell tasks. Tasks make it easier to automate your workflows. With our new task provider commands, you can easily create workflows that include configuration, build, install, test, clean, and clean rebuild tasks.\u00a0 <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h5><em>Selecting targets now supported<\/em><\/h5>\n<p><span class=\"TextRun SCXW141363534 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW141363534 BCX8\">Now, in your build task, users can specify <\/span><span class=\"NormalTextRun SCXW141363534 BCX8\">multiple <\/span><span class=\"NormalTextRun SCXW141363534 BCX8\">targets<\/span><\/span>\u00a0<span class=\"TextRun SCXW141363534 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW141363534 BCX8\">and it is included as a parameter in the task template.<\/span> <span class=\"NormalTextRun CommentStart SCXW141363534 BCX8\">Before, this was a single active target selected in the status bar<\/span><span class=\"NormalTextRun SCXW141363534 BCX8\">.<\/span><span class=\"NormalTextRun SCXW141363534 BCX8\"> Now, you can select any target independent of the state of the extension. An example of a build task to target multiple targets (<\/span><span class=\"NormalTextRun CommentStart CommentHighlightPipeRest CommentHighlightRest SCXW141363534 BCX8\">\u201cmain\u201d and \u201csum<\/span><\/span><span class=\"TrackChangeTextInsertion TrackedChange SCXW141363534 BCX8\"><span class=\"TextRun SCXW141363534 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentHighlightRest SCXW141363534 BCX8\">\u201d<\/span><\/span><\/span><span class=\"TextRun SCXW141363534 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentHighlightPipeRest SCXW141363534 BCX8\">) using this feature is seen below.\u00a0<\/span><\/span><span class=\"EOP SCXW141363534 BCX8\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130429.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-30659\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130429.png\" alt=\"Example CMake build task with multiple targets\" width=\"831\" height=\"475\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130429.png 831w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130429-300x171.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130429-768x439.png 768w\" sizes=\"(max-width: 831px) 100vw, 831px\" \/><\/a><\/p>\n<h5><em>New CMake tasks supported<\/em><\/h5>\n<p><span class=\"TextRun SCXW197317236 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW197317236 BCX8\">To run and configure tasks, press <\/span><code><span class=\"NormalTextRun CommentStart CommentHighlightPipeClicked CommentHighlightClicked SCXW197317236 BCX8\">Ctrl<\/span><span class=\"NormalTextRun CommentHighlightPipeRest CommentHighlightClicked SCXW197317236 BCX8\">+Shift+P<\/span><\/code><span class=\"NormalTextRun CommentHighlightPipeClicked SCXW197317236 BCX8\"> to pull up the Command Palette<\/span><span class=\"NormalTextRun SCXW197317236 BCX8\"> and select the <\/span><span class=\"NormalTextRun SCXW197317236 BCX8\">appropriate option<\/span><span class=\"NormalTextRun SCXW197317236 BCX8\"> for your tasks.\u00a0<\/span><\/span><span class=\"EOP SCXW197317236 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130904.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-30660\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130904.png\" alt=\"Command Palette drop-down with CMake tasks selected\" width=\"895\" height=\"489\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130904.png 895w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130904-300x164.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-130904-768x420.png 768w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/a><\/p>\n<p><span class=\"TextRun SCXW193002484 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW193002484 BCX8\">To create a new task, first select \u201cConfigure Task\u201d from the dropdown. This will populate the view below in a C++ project.\u00a0<\/span><\/span><span class=\"EOP SCXW193002484 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-131342.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-30662\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-131342.png\" alt=\"CMake tasks that the user can select to configure\" width=\"862\" height=\"564\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-131342.png 862w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-131342-300x196.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-131342-768x502.png 768w\" sizes=\"(max-width: 862px) 100vw, 862px\" \/><\/a><\/p>\n<p><span class=\"TextRun SCXW134353995 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW134353995 BCX8\">You can select the <\/span><span class=\"NormalTextRun SCXW134353995 BCX8\">appropriate task<\/span><span class=\"NormalTextRun SCXW134353995 BCX8\">, which will populate the task template in the <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW134353995 BCX8\">tasks.json<\/span><span class=\"NormalTextRun SCXW134353995 BCX8\"> file.\u00a0<\/span><\/span><span class=\"EOP SCXW134353995 BCX8\" data-ccp-props=\"{}\"> <span data-ccp-props=\"{&quot;201341983&quot;:1,&quot;335559740&quot;:285}\"><span class=\"TextRun SCXW209175148 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW209175148 BCX8\">We recommend updating the &#8220;<\/span><span class=\"NormalTextRun CommentStart ContextualSpellingAndGrammarErrorV2Themed CommentHighlightPipeRest CommentHighlightRest SCXW209175148 BCX8\">detail&#8221;<\/span> field in the JSON object for your CMake tasks <span class=\"NormalTextRun CommentHighlightPipeRest SCXW209175148 BCX8\">so that you can differentiate the tasks from the drop-down<\/span><\/span><span class=\"TrackChangeTextInsertion TrackedChange SCXW209175148 BCX8\"><span class=\"TextRun SCXW209175148 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW209175148 BCX8\">.<\/span><\/span><\/span><span class=\"EOP SCXW209175148 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/span><\/span><\/p>\n<p><span class=\"TextRun SCXW23532722 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW23532722 BCX8\">Once the task is created, you can select this task to run using \u201cRun Task<\/span><span class=\"NormalTextRun SCXW23532722 BCX8\">\u201d from the Command Palette<\/span><span class=\"NormalTextRun SCXW23532722 BCX8\">,<\/span><span class=\"NormalTextRun SCXW23532722 BCX8\"> which will run the shell commands for the created task.<\/span><\/span><span class=\"EOP SCXW23532722 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-133234.png\"><img decoding=\"async\" class=\"alignnone wp-image-30665 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-133234.png\" alt=\"Example CMake tasks to select to run\" width=\"937\" height=\"469\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-133234.png 937w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-133234-300x150.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/06\/Screenshot-2022-06-14-133234-768x384.png 768w\" sizes=\"(max-width: 937px) 100vw, 937px\" \/><\/a><\/p>\n<h4>Coming Soon<\/h4>\n<p><span class=\"TextRun SCXW82567180 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW82567180 BCX8\">We are working to add even more support for the \u2018<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW82567180 BCX8\">CMake<\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">\u2019 task provider<\/span><span class=\"NormalTextRun CommentStart SCXW82567180 BCX8\">, including adding <\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">\u201c<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW82567180 BCX8\">args<\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">\u201d<\/span><span class=\"NormalTextRun CommentStart SCXW82567180 BCX8\"> and <\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">\u201c<\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">environment<\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">\u201d<\/span><span class=\"NormalTextRun SCXW82567180 BCX8\"> specification for your tasks<\/span><span class=\"NormalTextRun SCXW82567180 BCX8\">.<\/span><\/span><span class=\"EOP SCXW82567180 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h4>What do you think?<\/h4>\n<p><span class=\"TextRun SCXW103334939 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW103334939 BCX8\">Download the <\/span><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cmake-tools\"><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightRest SCXW103334939 BCX8\">CMake<\/span><span class=\"NormalTextRun CommentHighlightRest SCXW103334939 BCX8\"> Tools extension<\/span> <\/a><span class=\"NormalTextRun CommentHighlightPipeRest SCXW103334939 BCX8\">for Visual Studio Code<\/span><span class=\"NormalTextRun SCXW103334939 BCX8\"> and let us know what you think. If you run into any issues or have any suggestions, please report them in the <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\"><span class=\"NormalTextRun CommentStart CommentHighlightPipeRest CommentHighlightRest SCXW103334939 BCX8\">Issues section of our GitHub repository<\/span><\/a><span class=\"NormalTextRun CommentHighlightPipeRest SCXW103334939 BCX8\">. We would love to hear how you are using CMake tasks. Comment <\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW103334939 BCX8\">below<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW103334939 BCX8\">, <\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW103334939 BCX8\">or<\/span><span class=\"NormalTextRun SCXW103334939 BCX8\"> reach us <\/span><span class=\"NormalTextRun SCXW103334939 BCX8\">via<\/span><span class=\"NormalTextRun SCXW103334939 BCX8\"> email at <\/span><\/span><a class=\"Hyperlink SCXW103334939 BCX8\" href=\"mailto:visualcpp@microsoft.com\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW103334939 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW103334939 BCX8\" data-ccp-charstyle=\"Hyperlink\">visualcpp@microsoft.com<\/span><\/span><\/a><span class=\"TextRun SCXW103334939 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW103334939 BCX8\"> or via <\/span><span class=\"NormalTextRun SCXW103334939 BCX8\">Twitter at <\/span><a href=\"https:\/\/twitter.com\/visualc\"><span class=\"NormalTextRun CommentStart CommentHighlightPipeRest CommentHighlightRest SCXW103334939 BCX8\">@VisualC<\/span><\/a><span class=\"NormalTextRun CommentHighlightPipeRest SCXW103334939 BCX8\">.<\/span><\/span><span class=\"EOP SCXW103334939 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest version of CMake tools is now available for download in the VS Code Marketplace or using the .vsix file. We have been working hard on improving the CMake experience and are excited to share some new features and improvements for users starting in version 1.11.\u00a0 \u2018CMake\u2019 task provider updates\u00a0 We have added more [&hellip;]<\/p>\n","protected":false},"author":85413,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,266,275],"tags":[],"class_list":["post-30616","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","category-cmake","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>The latest version of CMake tools is now available for download in the VS Code Marketplace or using the .vsix file. We have been working hard on improving the CMake experience and are excited to share some new features and improvements for users starting in version 1.11.\u00a0 \u2018CMake\u2019 task provider updates\u00a0 We have added more [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/30616","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\/85413"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=30616"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/30616\/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=30616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=30616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=30616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}