{"id":34197,"date":"2024-05-28T16:10:51","date_gmt":"2024-05-28T16:10:51","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=34197"},"modified":"2024-05-28T16:10:51","modified_gmt":"2024-05-28T16:10:51","slug":"visual-studio-code-cmake-tools-extension-1-18-update-quick-start-with-cmake-and-more","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/visual-studio-code-cmake-tools-extension-1-18-update-quick-start-with-cmake-and-more\/","title":{"rendered":"Visual Studio Code CMake Tools Extension 1.18 Update: Quick Start with CMake and more&#8230;"},"content":{"rendered":"<p>The May release of CMake Tools in VS Code is now available. With this release, we have some new updates to the extension to improve CMake integrations with the extension&#8217;s support.<\/p>\n<p>Some major highlights include improvements to the <strong>CMake: Quick Start<\/strong> command and support for CMake presets v7 and v8.<\/p>\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 (@OrkunTokdemir and @hippo91). We greatly appreciate your continued support!<\/p>\n<h3>CMake: Quick Start Updates<\/h3>\n<p><span class=\"TextRun SCXW7110224 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW7110224 BCX8\">The <\/span><\/span><span class=\"TextRun SCXW7110224 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed SCXW7110224 BCX8\">CMake<\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">: Quick Start<\/span><\/span><span class=\"TextRun SCXW7110224 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW7110224 BCX8\"> command <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">is a command <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">that <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">a<\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">ssists<\/span><span class=\"NormalTextRun SCXW7110224 BCX8\"> users <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">in<\/span> <span class=\"NormalTextRun CommentStart SCXW7110224 BCX8\">building <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">an existing <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">simple <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">project <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">with <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW7110224 BCX8\">CMake<\/span> <span class=\"NormalTextRun SCXW7110224 BCX8\">when they <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">do not have a CMakeLists.txt file in their project. <\/span><span class=\"NormalTextRun SCXW7110224 BCX8\">It generates a CMakeLists.txt file for you, so that you can add <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW7110224 BCX8\">CMake<\/span><span class=\"NormalTextRun SCXW7110224 BCX8\"> support to your project.<\/span><\/span><span class=\"EOP SCXW7110224 BCX8\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:278}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/cmake-quick-start-command.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-34199\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/cmake-quick-start-command.png\" alt=\"The CMake: Quick Start command in the command palette in VS Code\" width=\"1028\" height=\"116\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/cmake-quick-start-command.png 1028w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/cmake-quick-start-command-300x34.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/cmake-quick-start-command-1024x116.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/cmake-quick-start-command-768x87.png 768w\" sizes=\"(max-width: 1028px) 100vw, 1028px\" \/><\/a><\/p>\n<p>This command has been updated to integrate better with your pre-existing project needs by:<\/p>\n<ul>\n<li>Allowing you to add pre-existing .cpp files as targets in the generated CMakeLists.txt file<\/li>\n<li>Allowing you to dynamically add other support to your CMakeLists.txt file, such as CPack (packaging) and CTest (testing)<\/li>\n<li>Adding support to generate a <a href=\"https:\/\/cmake.org\/cmake\/help\/latest\/manual\/cmake-presets.7.html\">CMakePresets.json<\/a> file for your project based on custom configurations or pre-existing compilers on your machine.<\/li>\n<\/ul>\n<p>Now, when you are starting up a CMake project and need to onboard .cpp files to CMake, you are set up for ultimate levels of customizability and success.<\/p>\n<h5><strong>How it works<\/strong><\/h5>\n<p>When you invoke\u00a0<strong>CMake: Quick Start<\/strong> via the command palette (<code>Ctrl+Shift+P<\/code>), you&#8217;ll be prompted to name your project. From there, we&#8217;ve enhanced our experience to dynamically generate a CMakeLists.txt file and CMakePresets.json file.<\/p>\n<p>For the CMakeLists.txt file, you will now have additional options to add CPack and CTest support to your CMakeLists.txt file.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/quick-start-cpack-ctest.png\"><img decoding=\"async\" class=\"size-full wp-image-34200 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/quick-start-cpack-ctest.png\" alt=\"The option in the command palette to select CPack and CTest support in a multi-select format\" width=\"1051\" height=\"187\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/quick-start-cpack-ctest.png 1051w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/quick-start-cpack-ctest-300x53.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/quick-start-cpack-ctest-1024x182.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/quick-start-cpack-ctest-768x137.png 768w\" sizes=\"(max-width: 1051px) 100vw, 1051px\" \/><\/a>Additionally, you can select to add any pre-existing .cpp files in your projects as CMake targets in your CMakeLists.txt file, so that you can run these with CMake. If you do not select a pre-existing .cpp file or you don&#8217;t have any pre-existing .cpp files, the extension will generate a new &#8220;Hello World&#8221; .cpp file and add it as a target.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/add-targets-cmake-quickstart.png\"><img decoding=\"async\" class=\"size-full wp-image-34201 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/add-targets-cmake-quickstart.png\" alt=\"The dropdown view in the command palette to add existing .cpp files as targets in the CMakeLists.txt file\" width=\"1032\" height=\"125\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/add-targets-cmake-quickstart.png 1032w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/add-targets-cmake-quickstart-300x36.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/add-targets-cmake-quickstart-1024x124.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/add-targets-cmake-quickstart-768x93.png 768w\" sizes=\"(max-width: 1032px) 100vw, 1032px\" \/><\/a>This will generate the CMakeLists.txt file that your project will need to build with CMake.<\/p>\n<p>It will then enter an optional workflow to generate a CMakePresets.json. CMake presets are a central JSON file that store CMake configurations for CMake actions like configure, build, test, and more. This allows you to seamlessly move your project between desired configurations, other colleagues, different operating systems, and other IDEs.<\/p>\n<p>In this workflow, the command palette will prompt you to select a configuration type to use as a configure preset. You can generate from a custom configure preset, a toolchain file, or by scanning your machine for compilers. If you&#8217;re just getting started with CMake, we&#8217;d recommend creating from compilers. For more on configure presets, please read <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/blob\/main\/docs\/cmake-presets.md\">our docs<\/a>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/configure-preset-cmake-quickstart.png\"><img decoding=\"async\" class=\"size-full wp-image-34202 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/configure-preset-cmake-quickstart.png\" alt=\"Option to select a configure preset in the CMake Quick Start command palette, with toolchain file, custom, and compiler options\" width=\"1070\" height=\"226\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/configure-preset-cmake-quickstart.png 1070w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/configure-preset-cmake-quickstart-300x63.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/configure-preset-cmake-quickstart-1024x216.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/05\/configure-preset-cmake-quickstart-768x162.png 768w\" sizes=\"(max-width: 1070px) 100vw, 1070px\" \/><\/a><\/p>\n<p>After going through the entire updated workflow, you&#8217;ll be able to build your .cpp files using CMake with a new CMakeLists.txt file and CMakePresets.json file.<\/p>\n<h3>CMake Presets v7 and v8 Support<\/h3>\n<p><span data-contrast=\"auto\">We have added support for CMake presets files up to version 8 in our VS Code extension.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:278}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">CMake presets v7 includes the support for the <\/span><b><span data-contrast=\"auto\">trace<\/span><\/b><span data-contrast=\"auto\"> property in your configure presets. To learn more about the trace property, please visit the <\/span><a href=\"https:\/\/cmake.org\/cmake\/help\/latest\/manual\/cmake-presets.7.html#configure-preset:~:text=the%20command%20line.-,trace,-An%20optional%20object\"><span data-contrast=\"none\">CMake Presets official documentation<\/span><\/a><span data-contrast=\"auto\"> by Kitware.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:278}\">\u00a0<\/span><\/p>\n<h3>What do you think?<\/h3>\n<p><span class=\"TextRun Highlight SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\">Download the\u202f<\/span><\/span><a class=\"Hyperlink SCXW75748843 BCX8\" href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cmake-tools\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Highlight Underlined SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\" data-ccp-charstyle=\"Hyperlink\">CMake\u202fTools extension\u202f<\/span><\/span><\/a><span class=\"TextRun Highlight SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\">for Visual Studio Code and let us know what you think.\u202fWe would love to see what you<\/span><span class=\"NormalTextRun CommentStart SCXW75748843 BCX8\"> contribute to our<\/span><\/span><a class=\"Hyperlink SCXW75748843 BCX8\" href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Highlight Underlined SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\" data-ccp-charstyle=\"Hyperlink\">\u202frepo<\/span><\/span><\/a><span class=\"TextRun Highlight SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\">\u202f<\/span><span class=\"NormalTextRun SCXW75748843 BCX8\">and we are active on reviews and collaboration.<\/span><span class=\"NormalTextRun SCXW75748843 BCX8\"> Please create an <\/span><\/span><a class=\"Hyperlink SCXW75748843 BCX8\" href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Highlight Underlined SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\" data-ccp-charstyle=\"Hyperlink\">issue<\/span><\/span><\/a><span class=\"TextRun Highlight SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\"> if <\/span><span class=\"NormalTextRun SCXW75748843 BCX8\">there\u2019s<\/span><span class=\"NormalTextRun SCXW75748843 BCX8\"> anything <\/span><span class=\"NormalTextRun SCXW75748843 BCX8\">you\u2019d<\/span><span class=\"NormalTextRun SCXW75748843 BCX8\"> like to see and upvote\/downvote any existing issues.<\/span><span class=\"NormalTextRun SCXW75748843 BCX8\"> Comment below or reach us via email at\u202f<\/span><\/span><a class=\"Hyperlink SCXW75748843 BCX8\" href=\"mailto:visualcpp@microsoft.com\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Highlight Underlined SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\" data-ccp-charstyle=\"Hyperlink\">visualcpp@microsoft.com<\/span><\/span><\/a><span class=\"TextRun Highlight SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\">\u202for via\u202fX at\u202f<\/span><\/span><a class=\"Hyperlink SCXW75748843 BCX8\" href=\"https:\/\/twitter.com\/visualc\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Highlight Underlined SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\" data-ccp-charstyle=\"Hyperlink\">@VisualC<\/span><\/span><\/a><span class=\"TextRun Highlight SCXW75748843 BCX8\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW75748843 BCX8\">.<\/span><\/span><span class=\"EOP SCXW75748843 BCX8\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:278}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The May release of CMake Tools in VS Code is now available. With this release, we have some new updates to the extension to improve CMake integrations with the extension&#8217;s support. Some major highlights include improvements to the CMake: Quick Start command and support for CMake presets v7 and v8. To view the full list [&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-34197","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 May release of CMake Tools in VS Code is now available. With this release, we have some new updates to the extension to improve CMake integrations with the extension&#8217;s support. Some major highlights include improvements to the CMake: Quick Start command and support for CMake presets v7 and v8. To view the full list [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/34197","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=34197"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/34197\/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=34197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=34197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=34197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}