{"id":34134,"date":"2024-05-09T16:36:22","date_gmt":"2024-05-09T16:36:22","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=34134"},"modified":"2024-05-09T16:36:22","modified_gmt":"2024-05-09T16:36:22","slug":"building-your-cpp-code-with-cmake-in-vs-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/building-your-cpp-code-with-cmake-in-vs-code\/","title":{"rendered":"Building your C++ Code with CMake in VS Code"},"content":{"rendered":"<p><span data-contrast=\"none\">Build systems can help you manage your C++ project as it grows in scope and complexity, whether you are adding new features, dependencies, or cross-platform support. A popular choice in the C++ community is <\/span><a href=\"https:\/\/cmake.org\/\"><span data-contrast=\"none\">CMake<\/span><\/a><span data-contrast=\"none\"> which supports<\/span><span data-contrast=\"none\"> cross-platform development, streamlines build processes and configurations, and has many levels of customization.<\/span><span data-contrast=\"none\"> It also has first class support both in <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/build\/cmake-projects-in-visual-studio?view=msvc-170\"><span data-contrast=\"none\">Visual Studio<\/span><\/a><span data-contrast=\"auto\"> and in<\/span><span data-contrast=\"none\"> VS Code via the <\/span><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cmake-tools\"><span data-contrast=\"none\">CMake Tools extension<\/span><\/a><span data-contrast=\"auto\">.\u00a0<\/span><span data-ccp-props=\"{&quot;335559685&quot;:-20,&quot;335559737&quot;:-20}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">Check out our recent video on the steps you need to take to install and configure CMake in VS Code:\u00a0\u00a0\u00a0<\/span><span data-ccp-props=\"{&quot;335559685&quot;:-20,&quot;335559737&quot;:-20}\">\u00a0<\/span><\/p>\n<p style=\"text-align: center;\"><iframe src=\"\/\/www.youtube.com\/embed\/_BWU5mWqVA4?si=ZUIxXeY0_Z05y1a4\" width=\"560\" height=\"314\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p><span data-contrast=\"none\">This video walks you through every step of the process:\u00a0<\/span><span data-ccp-props=\"{&quot;335559685&quot;:-20,&quot;335559737&quot;:-20}\">\u00a0<\/span><\/p>\n<ul>\n<li><span data-contrast=\"none\">What is a build system? Why do you need it?\u00a0<\/span><span data-ccp-props=\"{&quot;335559737&quot;:-20,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"none\">Installing CMake and the CMake Tools Extension<\/span><span data-ccp-props=\"{&quot;335559737&quot;:-20}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"none\">Creating a CMakeLists.txt file<\/span><span data-ccp-props=\"{&quot;335559737&quot;:-20}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"none\">How to use CMakePresets in your project<\/span><span data-ccp-props=\"{&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"none\">How to configure, build, and run your CMake project <\/span><span data-ccp-props=\"{&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<\/ul>\n<p aria-level=\"3\"><b><span data-contrast=\"none\">What do you think?<\/span><\/b><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335557856&quot;:16777215,&quot;335559738&quot;:0,&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">Let us know about your experience with the CMake Tools Extension in<\/span> <a href=\"https:\/\/github.com\/microsoft\/vscode-cmake-tools\"><span data-contrast=\"none\">the CMake Tools repo.<\/span><\/a><span data-contrast=\"none\"> You can also reach us by commenting below, emailing us at <\/span><a href=\"mailto:visualcpp@microsoft.com\"><span data-contrast=\"none\">visualcpp@microsoft.com,<\/span><\/a><span data-contrast=\"none\"> or via X\/Twitter at <\/span><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"none\">@VisualC<\/span><\/a><span data-contrast=\"none\">.<\/span><span data-ccp-props=\"{&quot;335557856&quot;:16777215,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Build systems can help you manage your C++ project as it grows in scope and complexity, whether you are adding new features, dependencies, or cross-platform support. A popular choice in the C++ community is CMake which supports cross-platform development, streamlines build processes and configurations, and has many levels of customization. It also has first class [&hellip;]<\/p>\n","protected":false},"author":101195,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,266,275],"tags":[3944,140,274,252,3943,3945,276],"class_list":["post-34134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","category-cmake","category-visual-studio-code","tag-build-system","tag-c","tag-c-extension","tag-cmake","tag-cmake-tools-extension","tag-cmakelist","tag-vscode"],"acf":[],"blog_post_summary":"<p>Build systems can help you manage your C++ project as it grows in scope and complexity, whether you are adding new features, dependencies, or cross-platform support. A popular choice in the C++ community is CMake which supports cross-platform development, streamlines build processes and configurations, and has many levels of customization. It also has first class [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/34134","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\/101195"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=34134"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/34134\/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=34134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=34134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=34134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}