![]() This walkthrough uses GCC and Ninja on Ubuntu. Sudo apt install g++ gdb make ninja-build rsync zipĬross-platform CMake development with a WSL 2 distro Install WSL and a WSL 2 distro by following the instructions at Install WSL.Īssuming your distro uses apt (this walkthrough uses Ubuntu), use the following commands to install the required build tools on your WSL 2 distro: sudo apt update You'll install a recent version of CMake using Visual Studio's CMake binary deployment in a later step. Install the tools necessary to build and debug on WSL 2. There's also more advanced information in this article under Advanced WSL 2 and CMake projects considerations. To learn more, see CMake Presets integration in Visual Studio and Visual Studio Code and Configure and build with CMake Presets in Visual Studio. The WSL 2 toolset is supported by CMake Presets integration in Visual Studio. To learn more about the differences between WSL 1 and WSL 2, see Comparing WSL 1 and WSL 2. It occurs automatically when Visual Studio detects you're using a WSL 2 distro. The local rsync copy doesn't require any user intervention. When targeting a WSL 2 distro, Visual Studio will execute a local rsync command to copy files from the Windows file system to the WSL file system. WSL 2 toolset backgroundĬ++ cross-platform support in Visual Studio assumes all source files originate in the Windows file system. We recommend CMake because it build and debug the same project on Windows, WSL, and remote systems.įor a video presentation of the information in this topic, see Video: Debug C++ with WSL 2 Distributions and Visual Studio 2022. CMake is our recommendation for all C++ cross-platform development with Visual Studio. Visual Studio's WSL 2 toolset supports both CMake and MSBuild-based Linux projects. You can already build and debug C++ code on WSL 1 distros using the native WSL 1 toolset introduced in Visual Studio 2019 version 16.1. Visual Studio's WSL 2 toolset allows you to use Visual Studio to build and debug C++ code on WSL 2 distros without adding a SSH connection. It provides better Linux file system performance, GUI support, and full system call compatibility. WSL 2 is the new, recommended version of the Windows Subsystem for Linux (WSL). This toolset is available now in Visual Studio 2022 version 17.0 or higher. Upon this action, your project's state is as described in Load CMake.Visual Studio 2022 introduces a native C++ toolset for Windows Subsystem for Linux version 2 (WSL 2) development. Use the Unload CMake Project action when you need to unlink your project off the CMake build system completely or when CLion loads a CMakeLists.txt script, but you want to use another one for your project.Ĭall Tools | CMake | Unload CMake Project from the main menu. You can control this behavior in Settings | Advanced Settings: When you add or delete targets and reload your project, CLion automatically creates or deletes the corresponding run/debug configurations. You can also assign a shortcut for the Stop CMake Project Reload action in Settings | Keymap Manage run/debug configurations on project reload Select the Stop CMake Project Reload action. To stop the process of reloading a project, use one of the following options:Ĭall Find Action ( Control+Shift+A) and start typing stop cmake. You can also assign a shortcut for the Reload CMake Project action in Settings | Keymap Stop project reload Go to File | Reload CMake Project or Tools | CMake | Reload CMake Project. To reload a project manually when needed, use one of the following options:Ĭall Find Action ( Control+Shift+A) and start typing reload cmake. To completely disable automatic reload including external changes, go to Settings | Advanced Settings and set the corresponding checkbox: Note that your project is reloaded automatically when you reset the CMake cache. This is similar to selecting the Reload CMake project on editing CMakeLists.txt or other CMake configuration files checkbox in Settings | Build, Execution, Deployment | CMake: This option lets CLion silently reload the project on every change in your CMakeLists.txt. ![]() In this case, you reload the project once, and all the subsequent changes in CMakeLists.txt will also require reloading. In this case, the notification will look as follows, suggesting two options for project reload: ![]() You can disable the floating notification in Settings | Advanced Settings | CMake: Reload CMake on changes in CMakeLists.txtīy default, when you make changes in the CMakeLists.txt file, CLion shows a floating notification indicating that the project needs to be reloaded:Ĭlick it or press the shortcut to reload CMake. To manually load a CMakeLists.txt file, right-click it in the project tree and select Load CMake Project from the context menu: When a CMakeLists.txt file is detected under the project root, CLion loads its automatically.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |