This tutorial shows how to create, build and debug a simple CMake-based project with Visual Studio.
Before you begin, make sure that VisualGDB 4.3 or later is installed.
- Start Visual Studio and open the “New Project” dialog. Select the Linux Project Wizard from VisualGDB folder:
- On the first wizard page ensure that “new project” is selected and then select the “Hello, World (CMake)” sample:
- On the next page select the Linux computer you want to target and press “Next”. If you have not configured the connection to that computer with VisualGDB yet, follow the generic Linux tutorial to set it up.
- On the next page specify how should the Linux machine access the source code. The easiest way would be to proceed with the default settings of uploading the modified sources to the Linux machine:
- Press “Finish” to complete the wizard. If this is the first project created on this machine, VisualGDB will cache the include directories from it so that IntelliSense can find all the headers:
- Once the project is created, press Ctrl-Shift-B to build your solution:
- You can customize various project settings using one of two ways. First of all, you can edit the CMakeLists.txt file directly. VisualGDB will provide syntax highlighting and basic IntelliSense:
- Second of all you can right-click on the project, select “VisualGDB Project Properties” and go to the CMake page:Note that the settings editing GUI will only work for the settings defined in CMakeLists.txt itself, but not in any of the included files.
- You can also switch an existing project to CMake by selecting it on the “Project settings” page:
- When you are done changing your settings, press F5 or F10 to begin debugging your project: