{"id":33670,"date":"2024-02-13T19:34:41","date_gmt":"2024-02-13T19:34:41","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=33670"},"modified":"2024-02-13T19:33:44","modified_gmt":"2024-02-13T19:33:44","slug":"visual-studio-code-cmake-tools-extension-1-17-update-cmake-presets-v6-overriding-cache-variables-and-side-bar-updates","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/visual-studio-code-cmake-tools-extension-1-17-update-cmake-presets-v6-overriding-cache-variables-and-side-bar-updates\/","title":{"rendered":"Visual Studio Code CMake Tools Extension 1.17 Update: CMake Presets v6, Overriding Cache Variables, and Side Bar Updates"},"content":{"rendered":"<p>The February release of the CMake Tools extension in VS Code is now available. With this release, we have three major new updates to the extension, including some of our highly upvoted requests:<\/p>\n<ul>\n<li>There is now support for CMake Presets v6, which includes the new <a href=\"https:\/\/cmake.org\/cmake\/help\/latest\/manual\/cmake-presets.7.html#workflow-preset\">workflow presets<\/a> and <a href=\"https:\/\/cmake.org\/cmake\/help\/latest\/manual\/cmake-presets.7.html#package-preset\">package presets<\/a>. (<a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/2871\">Issue #2871<\/a>)<\/li>\n<li>You can now pin common CMake Tools commands in the CMake side bar.<\/li>\n<li>You can now override\/add to cache variables and other settings when using CMake Presets (<a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/1836\">Issue #1836<\/a>)<\/li>\n<\/ul>\n<p>To view the full list of updates with this release, please look at our <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/blob\/main\/CHANGELOG.md\">CHANGELOG<\/a>. This release features 2 contributions from our open-source community, and we greatly thank you for your support!<\/p>\n<h3>CMake Presets v6 Support<\/h3>\n<p>Kitware has added two new CMake Presets in version 6: workflow and package presets. Workflow presets allow you to define a string of CMake presets that you want to execute (e.g.\u00a0 a configure action followed by a build action). Package presets are presets that invoke CPack to package your software based on a variety of specifications. You can learn more about these presets from <a href=\"https:\/\/cmake.org\/cmake\/help\/latest\/manual\/cmake-presets.7.html\">Kitware\u2019s CMake Presets documentation.<\/a> There is now added support to include these new preset types in your CMake presets file and invoke them through the extension.<\/p>\n<p>With this added capability, you can select and run these presets by default from the CMake Side bar as you would any other preset.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-sidebar-package-workflow.png\"><img decoding=\"async\" class=\"size-full wp-image-33671 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-sidebar-package-workflow.png\" alt=\"The Cmake Sidebar in VS Code with Package and Workflow nodes highlighted and their relevant presets\" width=\"709\" height=\"922\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-sidebar-package-workflow.png 709w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-sidebar-package-workflow-231x300.png 231w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><\/a><\/p>\n<p>Additionally, you can toggle the presets visibility across the side bar and status bar via the CMake Status Bar Visibility options through <strong>\u201c<code>workflow<\/code>\u201d<\/strong>, <strong>\u201c<code>workflowPreset<\/code>\u201d<\/strong>, and <strong>\u201c<code>packagePreset<\/code>\u201d<\/strong> settings. To learn more about the supported visibility options, please see <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/blob\/main\/docs\/cmake-options-configuration.md\">our documentation<\/a>.<\/p>\n<p>While CMake Presets v7 and v8 do not have official support yet in the product, expansion of <code>$penv{}<\/code> in #include<a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/pull\/3377\"> was added in the previous 1.16 release<\/a> of the extension. We will be working to add the full support for v7 and v8 in upcoming releases.<\/p>\n<h3>Override\/add to cache variables when using CMake Presets<\/h3>\n<p>One of our most highly-upvoted tickets was to add adjustments to CMake Presets by overriding\/adding to cache variables. There are now new <strong>settings.json <\/strong>fields that modify configuration, build, and testing to override CMake Presets environments and arguments if you require this workflow. Specifically, these fields include:<\/p>\n<p><em>Overrides any CMake command:<\/em><\/p>\n<ul>\n<li><code>cmake.environment<\/code><\/li>\n<\/ul>\n<p><em>Overrides configure CMake commands<\/em><\/p>\n<ul>\n<li><code>cmake.configureArgs<\/code><\/li>\n<\/ul>\n<p><em>Overrides build CMake commands<\/em><\/p>\n<ul>\n<li><code>cmake.buildArgs<\/code><\/li>\n<li><code>cmake.buildEnvironment<\/code><\/li>\n<li><code>cmake.buildToolsArgs<\/code><\/li>\n<\/ul>\n<p><em>Overrides test CMake commands<\/em><\/p>\n<ul>\n<li><code>cmake.ctestArgs<\/code><\/li>\n<li><code>cmake.testEnvironment<\/code><\/li>\n<\/ul>\n<p>If there are settings set in any of the above fields, the affected CMake presets will display in the UI whether override settings have been applied for ease of tracking.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/configure-args-override.png\"><img decoding=\"async\" class=\" wp-image-33672 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/configure-args-override-1024x560.png\" alt=\"An example of cmake.configureArgs override showing in the UI that override settings are applied.\" width=\"812\" height=\"444\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/configure-args-override-1024x560.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/configure-args-override-300x164.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/configure-args-override-768x420.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/configure-args-override.png 1246w\" sizes=\"(max-width: 812px) 100vw, 812px\" \/><\/a><\/p>\n<p>Additionally, a setting icon will appear that, when clicked, will open to the possible settings that may be affecting the configuration.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/settings-override-icon.png\"><img decoding=\"async\" class=\" wp-image-33673 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/settings-override-icon-1024x618.png\" alt=\"A Settings gear that allows you to view the settings overriding your Configure Preset.\" width=\"693\" height=\"418\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/settings-override-icon-1024x618.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/settings-override-icon-300x181.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/settings-override-icon-768x464.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/settings-override-icon.png 1189w\" sizes=\"(max-width: 693px) 100vw, 693px\" \/><\/a><\/p>\n<h3>Pin common CMake commands to side bar<\/h3>\n<p>If you commonly perform any type of CMake command, you can now pin these commands to the CMake side bar so that they\u2019re easily accessible. To add a new CMake command to the side bar, navigate to the <strong>Pinned CMake Commands<\/strong> section and select the plus sign to search for a new CMake command to add.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-pinned-commands.png\"><img decoding=\"async\" class=\"size-full wp-image-33675 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-pinned-commands.png\" alt=\"An empty pinned commands pane in the CMake side bar with the option to add a new commands\" width=\"766\" height=\"598\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-pinned-commands.png 766w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-pinned-commands-300x234.png 300w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/a><\/p>\n<p>To run any given command, just hover over the command and select the corresponding play button. You can also remove any command from the list by hovering over it, right-clicking, and selecting <strong>Unpin Command<\/strong>.<\/p>\n<h3><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-unpin-commands.png\"><img decoding=\"async\" class=\"size-large wp-image-33676 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-unpin-commands-1024x299.png\" alt=\"Whenever you have any cmake command pinned, you also have the option to unpin them.\" width=\"640\" height=\"187\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-unpin-commands-1024x299.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-unpin-commands-300x87.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-unpin-commands-768x224.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/02\/cmake-unpin-commands.png 1084w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a>What&#8217;s next?<\/h3>\n<p>We have a lot of exciting new things planned for the 1.18 release including <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/534\">adding the first layers of CMake language services to the extension<\/a>, <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/2984\">adding tasks to the CMake side bar<\/a>, and <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/3081\">having an option for CMake to be automatically installed when missing via package manager<\/a>. You can view these plans any time via <a href=\"https:\/\/github.com\/orgs\/microsoft\/projects\/1024\/views\/4\">our new GitHub project view<\/a>.<\/p>\n<p>Let our team know what else you would like to see from us by\u00a0<a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/3291\" target=\"_blank\" rel=\"noopener\">adding an issue to our repo<\/a>\u00a0or upvoting any existing issues with a thumbs up.<\/p>\n<h3 class=\"screenreader-text\" aria-atomic=\"true\" aria-live=\"polite\">What do you think?<\/h3>\n<p>Download the\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cmake-tools\" target=\"_blank\" rel=\"noopener\">CMake\u00a0Tools extension\u00a0<\/a>for Visual Studio Code and let us know what you think.\u00a0We would love to see what you contribute to our<a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\" target=\"_blank\" rel=\"noopener\">\u00a0repo<\/a>\u00a0and we are active on reviews and collaboration. Comment below or reach us via email at\u00a0<a href=\"mailto:visualcpp@microsoft.com\">visualcpp@microsoft.com<\/a>\u00a0or via\u00a0Twitter at\u00a0<a href=\"https:\/\/twitter.com\/visualc\" target=\"_blank\" rel=\"noopener\">@VisualC<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The February release of the CMake Tools extension in VS Code is now available. With this release, we have three major new updates to the extension, including some of our highly upvoted requests: There is now support for CMake Presets v6, which includes the new workflow presets and package presets. (Issue #2871) You can now [&hellip;]<\/p>\n","protected":false},"author":85413,"featured_media":33671,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[266,275],"tags":[],"class_list":["post-33670","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cmake","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>The February release of the CMake Tools extension in VS Code is now available. With this release, we have three major new updates to the extension, including some of our highly upvoted requests: There is now support for CMake Presets v6, which includes the new workflow presets and package presets. (Issue #2871) You can now [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/33670","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=33670"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/33670\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/33671"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=33670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=33670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=33670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}