{"id":24180,"date":"2019-04-24T17:00:52","date_gmt":"2019-04-24T17:00:52","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=24180"},"modified":"2019-04-24T17:29:29","modified_gmt":"2019-04-24T17:29:29","slug":"visual-studio-cmake-support-clang-llvm-cmake-3-14-vcpkg-and-performance-improvements","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/visual-studio-cmake-support-clang-llvm-cmake-3-14-vcpkg-and-performance-improvements\/","title":{"rendered":"Visual Studio CMake Support \u2013 Clang\/LLVM, CMake 3.14, Vcpkg, and Performance Improvements"},"content":{"rendered":"<p>We\u2019ve introduced a bunch of improvements to our CMake support in the <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\">latest preview of Visual Studio 2019 Update 1<\/a>. The latest release includes Clang\/LLVM support, CMake 3.14, better <a href=\"https:\/\/github.com\/Microsoft\/vcpkg#vcpkg\">vcpkg<\/a> integration, and many more enhancements. If you are not familiar with Visual Studio\u2019s CMake support, <a href=\"https:\/\/aka.ms\/cmake\">check out how to get started<\/a>.<\/p>\n<h3>Clang\/LLVM Support<\/h3>\n<p>Visual Studio now supports Clang\/LLVM for CMake projects and you can now use Clang to target Windows and remote Linux machines. Full IntelliSense is supported along with Visual Studio\u2019s comprehensive debugging support. Check out <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/clang-llvm-support-in-visual-studio\">our Clang\/LLVM post<\/a> for much more information.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-24156 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Clang-Compilers-for-Windows-Installer-Annotated.png\" alt=\"Install the \u201cClang compiler for Windows\u201d optional component as part of the \u201cDesktop development with C++\u201d workload.\" width=\"1250\" height=\"628\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Clang-Compilers-for-Windows-Installer-Annotated.png 1250w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Clang-Compilers-for-Windows-Installer-Annotated-300x151.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Clang-Compilers-for-Windows-Installer-Annotated-768x386.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Clang-Compilers-for-Windows-Installer-Annotated-1024x514.png 1024w\" sizes=\"(max-width: 1250px) 100vw, 1250px\" \/><\/p>\n<h3>CMake 3.14 with Performance Improvements and Visual Studio 2019 Generator<\/h3>\n<p>We\u2019ve updated the version of CMake that ships with Visual Studio to 3.14. This version includes the latest MSBuild generators that support Visual Studio 2019. You can learn more about <a href=\"https:\/\/cmake.org\/cmake\/help\/v3.14\/release\/3.14.html\">what&#8217;s new in CMake 3.14<\/a> in CMake\u2019s release notes.<\/p>\n<p>Microsoft also worked with the CMake community to bring a new way of interfacing IDEs with CMake in 3.14 that replaces CMake server mode. What this means for you, is that many CMake operations (especially configuration) will be faster from now on. If you are interested in learning more about this, we are going to be writing a whole post about this soon.<\/p>\n<h3>Better Vcpkg Integration<\/h3>\n<p>In our first release of Visual Studio 2019 we introduced basic <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/whats-new-in-cmake-visual-studio-2019-preview-2#vcpkg-integration\">integration with vcpkg<\/a>. In the latest preview we have enhanced with better integration with IntelliSense. Now, when you are adding a header for a missing library, we will recommend how to install it with vcpkg if it is available. There is also now IntelliSense for CMake\u2019s \u201cfind_package\u201d directive:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-24181 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Find-Package-IntelliSense.png\" alt=\"Install the \u201cClang compiler for Windows\u201d optional component as part of the \u201cDesktop development with C++\u201d workload.\" width=\"624\" height=\"214\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Find-Package-IntelliSense.png 624w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Find-Package-IntelliSense-300x103.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<h3>Simpler CMake Build and Install Roots<\/h3>\n<p>With Visual Studio 2019 version 16.1 Preview 2 we have updated the default build and install roots for local and remote CMake projects to be more in-line with the standard set by open-source CMake projects. When you create a new CMake project in Visual Studio using the \u201cCMake Project\u201d template, or add a new configuration to an existing project, the following build and install roots will be used. You can change these properties at any time by modifying the \u201cBuild root\u201d and \u201cInstall root\u201d (or \u201cRemote build root\u201d and \u201cRemote install root\u201d) properties of the <a href=\"https:\/\/nam06.safelinks.protection.outlook.com\/?url=https%3A%2F%2Fdevblogs.microsoft.com%2Fcppblog%2Fintroducing-the-new-cmake-project-settings-ui%2F&amp;data=02%7C01%7Cwibu%40microsoft.com%7C3f0ac49947944e5c8c7708d6c77d3a8c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636915737995320776&amp;sdata=Wy8e%2BQkI0TR1DUWjYKL%2F9oHV%2FD5wq1HTXXkWNKslHRU%3D&amp;reserved=0\">CMake Settings Editor<\/a>.<\/p>\n<p><strong>Local CMake Projects:<\/strong><\/p>\n<p>Build root: ${projectDir}\\\\out\\\\build\\\\${name}\nInstall root: ${projectDir}\\\\out\\\\install\\\\${name}<\/p>\n<p><strong>Remote CMake Projects:<\/strong><\/p>\n<p>Remote build root: $HOME\/.vs\/${projectDirName}\/${workspaceHash}\/out\/build\/${name}\nRemote install root: $HOME\/.vs\/${projectDirName}\/${workspaceHash}\/out\/install\/${name}<\/p>\n<p>All of the <a href=\"https:\/\/nam06.safelinks.protection.outlook.com\/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcpp%2Fbuild%2Fcmakesettings-reference%3Fview%3Dvs-2019&amp;data=02%7C01%7Cwibu%40microsoft.com%7C3f0ac49947944e5c8c7708d6c77d3a8c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636915737995330774&amp;sdata=2wRE5FsdDiozPgU8X4wzkdRT6sv%2F2mnI%2B%2F%2BsTqLW0A0%3D&amp;reserved=0\">macros used in CMakeSettings.json<\/a> can be referenced here. In these file paths:<\/p>\n<ul>\n<li>${projectDir} is the full path to the folder of the root CMakeLists.txt file<\/li>\n<li>${name} is the name of the configuration<\/li>\n<li>${projectDirName} is the name of the root directory (similar to ${projectDir} but omits the rest of the path)<\/li>\n<li>${workspaceHash} is a hash of the workspace location. It is used because project names are not guaranteed to be unique across directories.<\/li>\n<\/ul>\n<p>These changes also resolve an issue with the old default build\/install roots for Linux projects where you would see\u00a0a mkdir failure if there was no write access to the folder (\/var\/tmp\/\u2026).<\/p>\n<h3>Changes to the Default CMake Configuration<\/h3>\n<p>Previously, new CMake projects in Visual Studio would create a default configuration that was never saved to disc. Now Visual Studio will create a default \u201cx64-Debug\u201d or \u201cx86-Debug\u201d configuration that matches the bitness of your machine and persists like a normal configuration.<\/p>\n<h3>Enhanced Customizability for Importing Existing Caches<\/h3>\n<p>We\u2019ve added a new way to customize how existing caches are imported into Visual Studio. Previously, the IDE would re-run CMake with its initial settings to refresh the cache and build tree if you made changes to the CMake projects. You can now replace that behavior with any custom script or executable that drives the recreation of the CMake cache. If your project drives CMake with external scripts or custom tools, you can now fully integrate it with the IDE. Edit, build, and debug your complex codebases without having to leave the IDE and go back to the command line.<\/p>\n<p>To use this feature, just set \u201ccacheGenerationCommand\u201d to the command line of your script or tool in your CMakeSettings.json file:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-24182 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Cache-Generation-Command.png\" alt=\"Cache generation command in CMakeSettings.json using a Python script to invoke CMake.\" width=\"426\" height=\"16\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Cache-Generation-Command.png 426w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Cache-Generation-Command-300x11.png 300w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><\/p>\n<h3>Logging for\u00a0Remote\u00a0Connections in Visual Studio<\/h3>\n<p>With Visual Studio 2019 you can\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/get-started-linux-cmake?view=vs-2019\">develop C++ for both Linux and Windows<\/a> from the comfort of a single IDE. In Visual Studio 2019 version 16.1 Preview 2 we have added logging for\u00a0SSH connections\u00a0to remote systems.\u00a0This\u00a0makes\u00a0it easier\u00a0to diagnose issues with\u00a0remote connections\u00a0and provides full transparency into what commands are being executed on your remote machine.\u00a0Logs include connections,\u00a0all commands sent to the remote machine (their text, exit code and execution time), and\u00a0writes from Visual Studio to the shell.<\/p>\n<p>Logging\u00a0works for any cross-platform\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/cmake-projects-in-visual-studio?view=vs-2019\">CMake project<\/a>\u00a0or\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/linux\/configure-a-linux-project?view=vs-2019\">MSBuild\u00a0based Linux project<\/a>\u00a0in Visual Studio.\u00a0\u00a0To enable logging, navigate to Tools\u00a0&gt;\u00a0Options &gt; Cross Platform &gt;\u00a0Logging,\u00a0or search for\u00a0\u201cSSH logging\u201d in the search\u00a0bar at the top of your screen.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-24183 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Remote-Connection-Logging.png\" alt=\"Remote connection logging settings under Tools &gt; Options &gt; Cross Platform.\" width=\"624\" height=\"421\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Remote-Connection-Logging.png 624w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/04\/Remote-Connection-Logging-300x202.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<p>You can\u00a0configure\u00a0logging to a file or to the \u201cCross Platform Logging\u201d pane\u00a0in\u00a0the\u00a0Output Window.\u00a0Note that for\u00a0MSBuild\u00a0based Linux projects, commands issued to the remote machine by\u00a0MSBuild\u00a0will not get routed to the Output Window because they are emitted out-of-proc.\u00a0They are, however, logged to a file with the \u201cmsbuild_\u201d prefix.<\/p>\n<h3>Send Us Feedback<\/h3>\n<p>Your feedback is a critical part of ensuring that we can deliver the best CMake experience.\u00a0 We would love to know how\u00a0<a href=\"https:\/\/www.visualstudio.com\/vs\/preview\/\">Visual Studio 2019 version 16.1 Preview<\/a> 2\u00a0is working for you.\u00a0If you have any questions specific to CMake Tools, please reach out to\u00a0<a href=\"mailto:cmake@microsoft.com\">cmake@microsoft.com<\/a> or leave a comment.\u00a0If you find any issues or have a suggestion, the best way to reach out to us is to\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio\">Report a Problem<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve introduced a bunch of improvements to our CMake support in the latest preview of Visual Studio 2019 Update 1. The latest release includes Clang\/LLVM support, CMake 3.14, better vcpkg integration, and many more enhancements. If you are not familiar with Visual Studio\u2019s CMake support, check out how to get started.<\/p>\n","protected":false},"author":326,"featured_media":24181,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[563,266,279,269,272],"tags":[252,233,268],"class_list":["post-24180","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-clang","category-cmake","category-linux","category-openfolder","category-vcpkg","tag-cmake","tag-cross-platform","tag-openfolder"],"acf":[],"blog_post_summary":"<p>We\u2019ve introduced a bunch of improvements to our CMake support in the latest preview of Visual Studio 2019 Update 1. The latest release includes Clang\/LLVM support, CMake 3.14, better vcpkg integration, and many more enhancements. If you are not familiar with Visual Studio\u2019s CMake support, check out how to get started.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/24180","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\/326"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=24180"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/24180\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/24181"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=24180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=24180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=24180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}