{"id":32660,"date":"2023-08-09T18:34:09","date_gmt":"2023-08-09T18:34:09","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=32660"},"modified":"2023-08-09T18:37:46","modified_gmt":"2023-08-09T18:37:46","slug":"introducing-cmake-debugger-in-vs-code-debug-your-cmake-scripts-using-open-source-cmake-debugger","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/introducing-cmake-debugger-in-vs-code-debug-your-cmake-scripts-using-open-source-cmake-debugger\/","title":{"rendered":"Introducing CMake Debugger in VS Code: Debug your CMake Scripts using Open-Source CMake Debugger"},"content":{"rendered":"<p>The new CMake Debugger that <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/cmake-debugger-allows-you-to-debug-your-cmake-scripts-and-more\/\">was introduced in Visual Studio<\/a> is now available in VS Code. Now, you can debug your CMakeLists.txt scripts from VS Code using <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cmake-tools\">the CMake Tools Extension<\/a>. To see the full release notes for this release and what else is included, including bug fixes, please see the <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/blob\/main\/CHANGELOG.md\">release notes<\/a>.<\/p>\n<h3>Background<\/h3>\n<p>The Visual C++ team collaborated closely with Kitware, the CMake maintainers, to <a href=\"https:\/\/gitlab.kitware.com\/cmake\/cmake\/-\/merge_requests\/8838\">merge our CMake debugger implementation upstream<\/a> and make this widely available. This implementation is now available in <a href=\"https:\/\/www.kitware.com\/software-releases\/\">CMake version 3.27<\/a>. Please download the latest version for your OS via <a href=\"https:\/\/cmake.org\/download\/\">this link<\/a> or update via your system package manager to access the CMake debugger in VS Code. You can check your CMake version on your machine at any time by running <code>cmake \u2013version<\/code> in a terminal window. CMake 3.27 will ship with Visual Studio in a later release in 17.8.<\/p>\n<p>The debugger uses the widely supported <a href=\"https:\/\/microsoft.github.io\/debug-adapter-protocol\/implementors\/tools\">Debug Adapter Protocol,<\/a> which is compatible with many development environments. \u00a0We are excited to see how the open-source community works together to implement new ideas for the debugger.<\/p>\n<h3>CMake Debugger Functionality<\/h3>\n<p>As a user, you\u2019ll see the same functionality as you would in a normal debugging session. This includes viewing variables, call stacks, and cache variables specific to CMake and the ability to set breakpoints on your CMakeLists.txt file and step through your code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/CMakeDebugger.gif\"><img decoding=\"async\" class=\"size-full wp-image-32664 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/CMakeDebugger.gif\" alt=\"Using the CMake Debugger to VS Code and viewing CMake variables\" width=\"1897\" height=\"989\" \/><\/a><\/p>\n<p>To open the CMake Debugger in your project, you can select it from the command palette by pressing<code>Ctrl+Shift+P<\/code>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-101918.png\"><img decoding=\"async\" class=\"size-full wp-image-32665 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-101918.png\" alt=\"Command Palette dropdown to configure with CMake Debugger\" width=\"663\" height=\"112\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-101918.png 663w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-101918-300x51.png 300w\" sizes=\"(max-width: 663px) 100vw, 663px\" \/><\/a><\/p>\n<p>Additionally, it can be opened anywhere else you typically configure your project, such as in the CMake Project Outline in the CMake Tools side panel.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102117.png\"><img decoding=\"async\" class=\"size-full wp-image-32666 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102117.png\" alt=\"Option to Configure Project with CMake Debugger in CMake side panel.\" width=\"663\" height=\"121\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102117.png 663w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102117-300x55.png 300w\" sizes=\"(max-width: 663px) 100vw, 663px\" \/><\/a><\/p>\n<p>If your CMake configure ever fails, a notification will pop-up for you to interact with to launch the debugger.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102354.png\"><img decoding=\"async\" class=\"size-full wp-image-32667 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102354.png\" alt=\"CMake Configure Fail Error to allow you to open CMake Debugger\" width=\"646\" height=\"169\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102354.png 646w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2023\/08\/Screenshot-2023-08-01-102354-300x78.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/a><\/p>\n<h3>What&#8217;s next?<\/h3>\n<p>Next up, we are working on a few different things including\u00a0<a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\/534\" target=\"_blank\" rel=\"noopener\">implementing CMake language services<\/a> and re-vamping our overall CMake side panel and status bar experiences based on user feedback. Let us know what else you&#8217;d like to see!<\/p>\n<h3>Send us your feedback!<\/h3>\n<p>We hope this helps your CMake workflows in VS Code. Download the latest preview version of Visual Studio and give it a try. Download the\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cmake-tools\">CMake\u00a0Tools extension\u00a0<\/a>for Visual Studio Code and let us know what you think. We would love to see what you contribute to our <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\">repo<\/a> and are active on reviews and collaboration. If you have any issues, please file an issue to our repo <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\/issues\">here<\/a>. 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\">@VisualC<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The new CMake Debugger that was introduced in Visual Studio is now available in VS Code. Now, you can debug your CMakeLists.txt scripts from VS Code using the CMake Tools Extension. To see the full release notes for this release and what else is included, including bug fixes, please see the release notes. Background The [&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-32660","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 new CMake Debugger that was introduced in Visual Studio is now available in VS Code. Now, you can debug your CMakeLists.txt scripts from VS Code using the CMake Tools Extension. To see the full release notes for this release and what else is included, including bug fixes, please see the release notes. Background The [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/32660","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=32660"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/32660\/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=32660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=32660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=32660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}