Posted  by 

Cmake And Dev C++

CMake And C Development Services CMake has become somewhat of a de facto standard for build systems in the C world. When teams want to migrate to CMake or to update their projects to the latest best practices, they do not always have the in-house knowledge or available capacity to. Sample project playground created for learning Cmake and CI/CD for C development. maciejzj/cmake-project.

-->

Sep 28, 2019  Setup of C compiler flags for modern C features is easily and automatically handled by CMake or Meson. Set(CMAKECXXSTANDARDREQUIRED ON) addexecutable(filesepcpp filesep.cpp) setproperty(TARGET filesepcpp PROPERTY CXXSTANDARD 17) Compilers supporting C17 filesystem include: g ≥ 8. CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. How to setup gcc (MSYS2) for Eclipse in Windows for C development. Submitted by NanoDano on Wed, - 03:28. Optional: CMake. Make is already installed with the base-devel package, but if you want to use CMake you need to install it separately from base-devel and toolchain. CMake Example on Raspberry Pi C Installing CMake. Installing CMake on your Raspberry Pi is made easy by using the apt package manager. First thing you want to do is SSH into your Pi and at the terminal/command line enter the following sudo apt-get install cmake.

CMake is a cross-platform, open-source tool for defining build processes that run on multiple platforms. This article assumes you're familiar with CMake. You can learn more about it at Build, Test and Package Your Software With CMake.

Note

CMake has become more and more integrated with Visual Studio over the past few releases. To see the documentation for your preferred version of Visual Studio, use the Version selector control. It's found at the top of the table of contents on this page.

The C++ CMake tools for Windows component uses the Open Folder feature to consume CMake project files (such as CMakeLists.txt) directly for the purposes of IntelliSense and browsing. Both Ninja and Visual Studio generators are supported. If you use a Visual Studio generator, it generates a temporary project file and passes it to msbuild.exe. However, the project is never loaded for IntelliSense or browsing purposes. You can also import an existing CMake cache.

Installation

C++ CMake tools for Windows is installed as part of the Desktop development with C++ and Linux Development with C++ workloads. For more information, see Cross-platform CMake projects.

For more information, see Install the C++ Linux workload in Visual Studio.

IDE Integration

When you choose File > Open > Folder to open a folder containing a CMakeLists.txt file, the following things happen:

  • Visual Studio adds CMake items to the Project menu, with commands for viewing and editing CMake scripts.

  • Solution Explorer displays the folder structure and files.

  • Visual Studio runs cmake.exe and generates the CMake cache file (CMakeCache.txt) for the default (x64 Debug) configuration. The CMake command line is displayed in the Output Window, along with additional output from CMake.

  • In the background, Visual Studio starts to index the source files to enable IntelliSense, browsing information, refactoring, and so on. As you work, Visual Studio monitors changes in the editor and also on disk to keep its index in sync with the sources.

You can open folders containing any number of CMake projects. Visual Studio detects and configures all the 'root' CMakeLists.txt files in your workspace. CMake operations (configure, build, debug), C++ IntelliSense, and browsing are available to all CMake projects in your workspace.

You can also view your projects organized logically by targets. Choose Targets view from the dropdown in the Solution Explorer toolbar:

Click the Show All Files button at the top of Solution Explorer to see all the CMake-generated output in the out/build/<config> folders.

Visual Studio uses a configuration file called CMakeSettings.json. This file lets you define and store multiple build configurations, and conveniently switch between them in the IDE. A configuration is a Visual Studio construct that encapsulates settings that are specific to a given build type. The settings are used to configure the default command-line options that Visual Studio passes to cmake.exe. You can also specify additional CMake options here, and define any additional variables you like. All options are written to the CMake cache either as internal or external variables. In Visual Studio 2019, the CMake Settings Editor provides a convenient way to edit your settings. For more information, see Customize CMake settings.

One setting, intelliSenseMode isn't passed to CMake, but is used only by Visual Studio.

Use the CMakeLists.txt file in each project folder just as you would in any CMake project. You can specify source files, find libraries, set compiler and linker options, and specify other build system-related information.

To pass arguments to an executable at debug time, you can use another file called launch.vs.json. In some scenarios, Visual Studio automatically generates these files. You can edit them manually, or even create the file yourself.

Note

For other kinds of Open Folder projects, two additional JSON files are used: CppProperties.json and tasks.vs.json. Neither of these are relevant for CMake projects.

Open an existing cache

When you open an existing CMake cache file (CMakeCache.txt), Visual Studio doesn't try to manage your cache and build tree for you. Your custom or preferred tools have complete control over how CMake configures your project. To open an existing cache in Visual Studio, choose File > Open > CMake. Then, navigate to an existing CMakeCache.txt file.

You can add an existing CMake cache to an open project. It's done the same way you'd add a new configuration. For more information, see our blog post on opening an existing cache in Visual Studio.

Building CMake projects

To build a CMake project, you have these choices:

  1. In the General toolbar, find the Configurations dropdown. It probably shows 'x64-Debug' by default. Select the preferred configuration and press F5, or click the Run (green triangle) button on the toolbar. The project automatically builds first, just like a Visual Studio solution.

  2. Right click on CMakeLists.txt and select Build from the context menu. If you have multiple targets in your folder structure, you can choose to build all or only one specific target.

  3. From the main menu, select Build > Build All (F7 or Ctrl+Shift+B). Make sure that a CMake target is already selected in the Startup Item dropdown in the General toolbar.

As you would expect, build results are shown in the Output Window and Error List.

In a folder with multiple build targets, you can specify which CMake target to build: Choose the Build item on the CMake menu or the CMakeLists.txt context menu to specify the target. If you enter Ctrl+Shift+B in a CMake project, it builds the current active document.

Debugging CMake projects

To debug a CMake project, choose the preferred configuration and press F5, or press the Run button in the toolbar. If the Run button says 'Select Startup Item', select the dropdown arrow. Choose the target that you want to run. (In a CMake project, the 'Current document' option is only valid for .cpp files.)

The Run or F5 commands first build the project if changes have been made since the previous build. Changes to CMakeSettings.json cause the CMake cache to be regenerated.

You can customize a CMake debugging session by setting properties in the launch.vs.json file. For more information, see Configure CMake debugging sessions.

Just My Code for CMake projects

When you build for Windows using the MSVC compiler, CMake projects have support for Just My Code debugging. To change the Just My Code setting, go to Tools > Options > Debugging > General.

Vcpkg integration

If you have installed vcpkg, CMake projects opened in Visual Studio automatically integrate the vcpkg toolchain file. That means no additional configuration is required to use vcpkg with your CMake projects. This support works for both local vcpkg installations and vcpkg installations on remote systems that you're targeting. This behavior is disabled automatically when you specify any other toolchain in your CMake Settings configuration.

Customize configuration feedback

By default, most configuration messages are suppressed unless there's an error. You can see all messages by enabling this feature in Tools > Options > CMake.

Editing CMakeLists.txt files

To edit a CMakeLists.txt file, right-click on the file in Solution Explorer and choose Open. If you make changes to the file, a yellow status bar appears and informs you that IntelliSense will update. It gives you a chance to cancel the update operation. For information about CMakeLists.txt, see the CMake documentation.

As soon as you save the file, the configuration step automatically runs again and displays information in the Output window. Errors and warnings are shown in the Error List or Output window. Double-click on an error in the Error List to navigate to the offending line in CMakeLists.txt.

CMake configure step

When you make significant changes to the CMakeSettings.json or to CMakeLists.txt files, Visual Studio automatically reruns the CMake configure step. If the configure step finishes without errors, the information that's collected is available in C++ IntelliSense and language services. It's also used in build and debug operations.

Troubleshooting CMake cache errors

If you need more information about the state of the CMake cache to diagnose a problem, open the Project main menu or the CMakeLists.txt context menu in Solution Explorer to run one of these commands:

  • View Cache opens the CMakeCache.txt file from the build root folder in the editor. (Any edits you make here to CMakeCache.txt are wiped out if you clean the cache. To make changes that persist after the cache is cleaned, see Customize CMake settings.)

  • Open Cache Folder opens an Explorer window to the build root folder.

  • Clean Cache deletes the build root folder so that the next CMake configure step starts from a clean cache.

  • Generate Cache forces the generate step to run even if Visual Studio considers the environment up to date.

Automatic cache generation can be disabled in the Tools > Options > CMake > General dialog.

Run CMake from the command line

If you have installed CMake from the Visual Studio Installer, you can run it from the command line by following these steps:

  1. Run the appropriate vsdevcmd.bat (x86/x64). For more information, see Building on the Command Line.

  2. Switch to your output folder.

  3. Run CMake to build/configure your app.

Visual Studio 2017 has rich support for CMake, including cross-platform CMake projects. The Visual C++ Tools for CMake component uses the Open Folder feature to enable the IDE to consume CMake project files (such as CMakeLists.txt) directly for the purposes of IntelliSense and browsing. Both Ninja and Visual Studio generators are supported. If you use a Visual Studio generator, it generates a temporary project file and passes it to msbuild.exe. However, the project is never loaded for IntelliSense or browsing purposes. You also can import an existing CMake cache.

Installation

Visual C++ Tools for CMake is installed as part of the Desktop development with C++ and Linux Development with C++ workloads.

For more information, see Install the C++ Linux workload in Visual Studio.

IDE integration

When you choose File > Open > Folder to open a folder containing a CMakeLists.txt file, the following things happen:

  • Visual Studio adds a CMake menu item to the main menu, with commands for viewing and editing CMake scripts.

  • Solution Explorer displays the folder structure and files.

  • Visual Studio runs CMake.exe and optionally generates the CMake cache for the default configuration, which is x86 Debug. The CMake command line is displayed in the Output Window, along with additional output from CMake.

  • In the background, Visual Studio starts to index the source files to enable IntelliSense, browsing information, refactoring, and so on. As you work, Visual Studio monitors changes in the editor and also on disk to keep its index in sync with the sources.

You can open folders containing any number of CMake projects. Visual Studio detects and configures all the 'root' CMakeLists.txt files in your workspace. CMake operations (configure, build, debug), C++ IntelliSense, and browsing are available to all CMake projects in your workspace.

You can also view your projects organized logically by targets. Choose Targets view from the dropdown in the Solution Explorer toolbar:

Visual Studio uses a file called CMakeSettings.json to store environment variables or command-line options for Cmake.exe. CMakeSettings.json also enables you to define and store multiple CMake build configurations. You can conveniently switch between them in the IDE.

Otherwise, use the CMakeLists.txt just as you would in any CMake project to specify source files, find libraries, set compiler and linker options, and specify other build system-related information.

If you need to pass arguments to an executable at debug time, you can use another file called launch.vs.json. In some scenarios, Visual Studio automatically generates these files. You can edit them manually, or even create the file yourself.

Note

For other kinds of Open Folder projects, two additional JSON files are used: CppProperties.json and tasks.vs.json. Neither of these are relevant for CMake projects.

Import an existing cache

When you import an existing CMakeCache.txt file, Visual Studio automatically extracts customized variables and creates a pre-populated CMakeSettings.json file based on them. The original cache isn't modified in any way. It can still be used from the command line, or with whatever tool or IDE used to generate it. The new CMakeSettings.json file is placed alongside the project's root CMakeLists.txt. Visual Studio generates a new cache based the settings file. You can override automatic cache generation in the Tools > Options > CMake > General dialog.

Not everything in the cache is imported. Properties such as the generator and the location of the compilers are replaced with defaults that are known to work well with the IDE.

To import an existing cache

  1. From the main menu, choose File > Open > CMake:

    This command brings up the Import CMake from Cache wizard.

  2. Navigate to the CMakeCache.txt file that you want to import, and then click OK. The Import CMake Project from Cache wizard appears:

    /precision-tune-auto-care-gig-harbor.html. When the wizard completes, you can see the new CMakeCache.txt file in Solution Explorer next to the root CMakeLists.txt file in your project.

Building CMake projects

To build a CMake project, you have these choices:

  1. In the General toolbar, find the Configurations dropdown. It's probably showing 'Linux-Debug' or 'x64-Debug' by default. Select the preferred configuration and press F5, or click the Run (green triangle) button on the toolbar. The project automatically builds first, just like a Visual Studio solution.

  2. Right click on the CMakeLists.txt and select Build from the context menu. If you have multiple targets in your folder structure, you can choose to build all or only one specific target.

  3. From the main menu, select Build > Build Solution (F7 or Ctrl+Shift+B). Make sure that a CMake target is already selected in the Startup Item dropdown in the General toolbar.

You can customize build configurations, environment variables, command-line arguments, and other settings in the CMakeSettings.json file. It lets you make changes without modifying the CMakeLists.txt file. For more information, see Customize CMake settings.

As you would expect, build results are shown in the Output Window and Error List.

In a folder with multiple build targets, you can specify which CMake target to build: Choose the Build item on the CMake menu or the CMakeLists.txt context menu to specify the target. If you enter Ctrl+Shift+B in a CMake project, it builds the current active document.

Debugging CMake projects

To debug a CMake project, choose the preferred configuration and press F5. Or, press the Run button in the toolbar. If the Run button says 'Select Startup Item', select the dropdown arrow and choose the target that you want to run. (In a CMake project, the 'Current document' option is only valid for .cpp files.)

The Run or F5 commands first build the project if changes have been made since the previous build.

You can customize a CMake debugging session by setting properties in the launch.vs.json file. For more information, see Configure CMake debugging sessions.

Editing CMakeLists.txt files

To edit a CMakeLists.txt file, right-click on the file in Solution Explorer and choose Open. If you make changes to the file, a yellow status bar appears and informs you that IntelliSense will update. It gives you a chance to cancel the update operation. For information about CMakeLists.txt, see the CMake documentation.

As soon as you save the file, the configuration step automatically runs again and displays information in the Output window. Errors and warnings are shown in the Error List or Output window. Double-click on an error in the Error List to navigate to the offending line in CMakeLists.txt.

CMake configure step

Cmake Declare List

When significant changes are made to the CMakeSettings.json or to CMakeLists.txt files, Visual Studio automatically reruns the CMake configure step. If the configure step finishes without errors, the information that's collected is available in C++ IntelliSense and language services. It's also used in build and debug operations.

Multiple CMake projects may use the same CMake configuration name (for example, x86-Debug). All of them are configured and built (in their own build root folder) when that configuration is selected. You can debug the targets from all of the CMake projects that participate in that CMake configuration.

You can limit builds and debug sessions to a subset of the projects in the workspace. Create a new configuration with a unique name in the CMakeSettings.json file. Then, apply the configuration to those projects only. When that configuration is selected, IntelliSense and the build and debug commands only apply to those specified projects.

Troubleshooting CMake cache errors

If you need more information about the state of the CMake cache to diagnose a problem, open the CMake main menu or the CMakeLists.txt context menu in Solution Explorer to run one of these commands:

  • View Cache opens the CMakeCache.txt file from the build root folder in the editor. (Any edits you make here to CMakeCache.txt are wiped out if you clean the cache. To make changes that persist after the cache is cleaned, see Customize CMake settings.)

  • Open Cache Folder opens an Explorer window to the build root folder.

  • Clean Cache deletes the build root folder so that the next CMake configure step starts from a clean cache.

  • Generate Cache forces the generate step to run even if Visual Studio considers the environment up to date.

Automatic cache generation can be disabled in the Tools > Options > CMake > General dialog.

Single file compilation

To build a single file in a CMake project, right-click on the file in Solution Explorer. Choose Compile from the pop-up menu. You can also build the currently open file in the editor by using the main CMake menu:

Run CMake from the command line

If you have installed CMake from the Visual Studio Installer, you can run it from the command line by following these steps:

C++
  1. Run the appropriate vsdevcmd.bat (x86/x64). For more information, see Building on the command line .

  2. Switch to your output folder.

  3. Run CMake to build/configure your app.

In Visual Studio 2015, Visual Studio users can use a CMake generator to generate MSBuild project files, which the IDE then consumes for IntelliSense, browsing, and compilation.

See also

Tutorial: Create C++ cross-platform projects in Visual Studio
Configure a Linux CMake project
Connect to your remote Linux computer
Customize CMake build settings
CMakeSettings.json schema reference
Configure CMake debugging sessions
Deploy, run, and debug your Linux project
CMake predefined configuration reference

-->

Visual Studio C and C++ development isn't just for Windows anymore. This tutorial shows how to use Visual Studio for C++ cross platform development on Windows and Linux. It's based on CMake, so you don't have to create or generate Visual Studio projects. When you open a folder that contains a CMakeLists.txt file, Visual Studio configures the IntelliSense and build settings automatically. You can quickly start editing, building, and debugging your code locally on Windows. Then, switch your configuration to do the same on Linux, all from within Visual Studio.

In this tutorial, you learn how to:

  • clone an open-source CMake project from GitHub
  • open the project in Visual Studio
  • build and debug an executable target on Windows
  • add a connection to a Linux machine
  • build and debug the same target on Linux

Prerequisites

  • Set up Visual Studio for Cross Platform C++ Development

    • First, install Visual Studio and choose the Desktop development with C++ and Linux development with C++ workloads. This minimal install is only 3 GB. Depending on your download speed, installation shouldn't take more than 10 minutes.
  • Set up a Linux machine for Cross Platform C++ Development

    • Visual Studio doesn't require any specific distribution of Linux. The OS can be running on a physical machine, in a VM, or in the cloud. You could also use the Windows Subsystem for Linux (WSL). However, for this tutorial a graphical environment is required. WSL isn't recommended here, because it's intended primarily for command-line operations.

    • Visual Studio requires these tools on the Linux machine: C++ compilers, gdb, ssh, rsync, ninja, and zip. On Debian-based systems, you can use this command to install these dependencies:

    • Visual Studio requires a recent version of CMake on the Linux machine that has server mode enabled (at least 3.8). Microsoft produces a universal build of CMake that you can install on any Linux distro. We recommend you use this build to ensure that you have the latest features. You can get the CMake binaries from the Microsoft fork of the CMake repo on GitHub. Go to that page and download the version that matches the system architecture on your Linux machine, then mark it as an executable:

    • You can see the options for running the script with -–help. We recommend that you use the –prefix option to specify installing in the /usr path, because /usr/bin is the default location where Visual Studio looks for CMake. The following example shows the Linux-x86_64 script. Change it as needed if you're using a different target platform.

  • Git for windows installed on your Windows machine.

  • A GitHub account.

Clone an open-source CMake project from GitHub

This tutorial uses the Bullet Physics SDK on GitHub. It provides collision detection and physics simulations for many applications. The SDK includes sample executable programs that compile and run without having to write additional code. This tutorial doesn't modify any of the source code or build scripts. To start, clone the bullet3 repository from GitHub on the machine where you have Visual Studio installed.

  1. On the Visual Studio main menu, choose File > Open > CMake. Navigate to the CMakeLists.txt file in the root of the bullet3 repo you just downloaded.

    As soon as you open the folder, your folder structure becomes visible in the Solution Explorer.

    This view shows you exactly what is on disk, not a logical or filtered view. By default, it doesn't show hidden files.

  2. Choose the Show all files button to see all the files in the folder.

Switch to targets view

When you open a folder that uses CMake, Visual Studio automatically generates the CMake cache. This operation might take a few moments, depending on the size of your project.

  1. In the Output Window, select Show output from and then choose CMake to monitor the status of the cache generation process. When the operation is complete, it says 'Target info extraction done'.

    After this operation completes, IntelliSense is configured. You can build the project, and debug the application. Visual Studio now shows a logical view of the solution, based on the targets specified in the CMakeLists files.

  2. Use the Solutions and Folders button in the Solution Explorer to switch to CMake Targets View.

    Here is what that view looks like for the Bullet SDK:

    Targets view provides a more intuitive view of what is in this source base. You can see some targets are libraries and others are executables.

  3. Expand a node in CMake Targets View to see its source code files, wherever those files might be located on disk.

Add an explicit Windows x64-Debug configuration

Visual Studio creates a default x64-Debug configuration for Windows. Configurations are how Visual Studio understands what platform target it's going to use for CMake. The default configuration isn't represented on disk. When you explicitly add a configuration, Visual Studio creates a file called CMakeSettings.json. It's populated with settings for all the configurations you specify.

  1. Add a new configuration. Open the Configuration drop-down in the toolbar and select Manage Configurations.

    The CMake Settings Editor opens. Select the green plus sign on the left-hand side of the editor to add a new configuration. The Add Configuration to CMakeSettings dialog appears.

    This dialog shows all the configurations included with Visual Studio, plus any custom configurations that you create. If you want to continue to use a x64-Debug configuration, that should be the first one you add. Select x64-Debug, and then choose the Select button. Visual Studio creates the CMakeSettings.json file with a configuration for x64-Debug, and saves it to disk. You can use whatever names you like for your configurations by changing the name parameter directly in CMakeSettings.json.

Set a breakpoint, build, and run on Windows

In this step, we'll debug an example program that demonstrates the Bullet Physics library.

  1. In Solution Explorer, select AppBasicExampleGui and expand it.

  2. Open the file BasicExample.cpp.

  3. Set a breakpoint that gets hit when you click in the running application. The click event is handled in a method within a helper class. To quickly get there:

    1. Select CommonRigidBodyBase that the struct BasicExample is derived from. It's around line 30.

    2. Right-click and choose Go to Definition. Now you're in the header CommonRigidBodyBase.h.

    3. In the browser view above your source, you should see that you're in the CommonRigidBodyBase. To the right, you can select members to examine. Open the drop-down and select mouseButtonCallback to go to the definition of that function in the header.

  4. Place a breakpoint on the first line within this function. It gets hit when you click a mouse button within the window of the application, when run under the Visual Studio debugger.

  5. To launch the application, select the launch drop-down in the toolbar. It's the one with the green play icon that says 'Select Startup Item'. In the drop-down, select AppBasicExampleGui.exe. The executable name now displays on the launch button:

  6. Choose the launch button to build the application and necessary dependencies, then launch it with the Visual Studio debugger attached. After a few moments, the running application appears:

  7. Move your mouse into the application window, then click a button to trigger the breakpoint. The breakpoint brings Visual Studio back to the foreground, and the editor shows the line where execution is paused. You can inspect the application variables, objects, threads, and memory, or step through your code interactively. Choose Continue to let the application resume, and then exit it normally. Or, halt execution within Visual Studio by using the stop button.

Add a Linux configuration and connect to the remote machine

  1. Add a Linux configuration. Right-click the CMakeSettings.json file in the Solution Explorer view and select Add Configuration. You see the same Add Configuration to CMakeSettings dialog as before. Select Linux-Debug this time, then save the CMakeSettings.json file (ctrl + s).

  2. Select Linux-Debug in the configuration drop-down.

    If it's the first time you're connecting to a Linux system, the Connect to Remote System dialog appears.

    If you've already added a remote connection, you can open this window by navigating to Tools > Options > Cross Platform > Connection Manager.

  3. Provide the connection information to your Linux machine and choose Connect. Visual Studio adds that machine as to CMakeSettings.json as your default connection for Linux-Debug. It also pulls down the headers from your remote machine, so you get IntelliSense specific to that remote connection. Next, Visual Studio sends your files to the remote machine and generates the CMake cache on the remote system. These steps may take some time, depending on the speed of your network and power of your remote machine. You'll know it's complete when the message 'Target info extraction done' appears in the CMake output window.

Set a breakpoint, build, and run on Linux

Cmake And Dev C Download

Because it's a desktop application, you need to provide some additional configuration information to the debug configuration.

  1. In the CMake Targets view, right-click AppBasicExampleGui and choose Debug and Launch Settings to open the launch.vs.json file that's in the hidden .vs subfolder. This file is local to your development environment. You can move it into the root of your project if you wish to check it in and save it with your team. In this file, a configuration has been added for AppBasicExampleGui. These default settings work in most cases, but not here. Because it's a desktop application, you need to provide some additional information to launch the program so you can see it on your Linux machine.

  2. To find the value of the environment variable DISPLAY on your Linux machine, run this command:

    In the configuration for AppBasicExampleGui, there's a parameter array, 'pipeArgs'. It contains a line: '${debuggerCommand}'. It's the command that launches gdb on the remote machine. Visual Studio must export the display into this context before that command runs. For example, if the value of your display is :1, modify that line as follows:

  3. Launch and debug your application. Open the Select Startup Item drop-down in the toolbar and choose AppBasicExampleGui. Next, either choose the green play icon in the toolbar, or press F5. The application and its dependencies are built on the remote Linux machine, then launched with the Visual Studio debugger attached. On your remote Linux machine, you should see an application window appear.

  4. Move your mouse into the application window, and click a button. The breakpoint is hit. Program execution pauses, Visual Studio comes back to the foreground, and you see your breakpoint. You should also see a Linux Console Window appear in Visual Studio. The window provides output from the remote Linux machine, and it can also accept input for stdin. Like any Visual Studio window, you can dock it where you prefer to see it. Its position is persisted in future sessions.

  5. You can inspect the application variables, objects, threads, memory, and step through your code interactively using Visual Studio. But this time, you're doing it all on a remote Linux machine instead of your local Windows environment. You can choose Continue to let the application resume and exit normally, or you can choose the stop button, just as with local execution.

  6. Look at the Call Stack window and view the Calls to x11OpenGLWindow since Visual Studio launched the application on Linux.

What you learned

In this tutorial, you cloned a code base directly from GitHub. You built, ran, and debugged it on Windows without modifications. Then you used the same code base, with minor configuration changes, to build, run, and debug on a remote Linux machine.

Next steps

Cmake C++ 17

Learn more about configuring and debugging CMake projects in Visual Studio:

Cmake C++ Standard

CMake Projects in Visual Studio
Configure a Linux CMake project
Connect to your remote Linux computer
Customize CMake build settings
Configure CMake debugging sessions
Deploy, run, and debug your Linux project
CMake predefined configuration reference