

#Cmake debug target code
Then add the following code to your CMakeLists.txt file:.First of all, create a file called version.txt in your project directory and ensure it contains a single character: “1” Now we will replace the hardcoded version with a CMake function that will read the version from a text file.VisualGDB will automatically insert the corresponding statement into the CMakeLists.txt file:.Open the Visual Studio project properties for the target and add “PROJECT_VERSION=1” to the preprocessor definitions:.VisualGDB will generate a simple CMake project with one target: In this tutorial we will build the code locally using the Raspberry Pi cross-toolchain: You can either build the code on the Windows machine using a cross-toolchain, or build it directly on the Linux machine, depending on your configuration. On the next page select the machine you want to target.Select “Create a new project” -> “Application” -> “CMake” and ensure that the “Use the advanced CMake Project Subsystem” checkbox is set:.Start Visual Studio and open the VisualGDB Linux Project Wizard:.
#Cmake debug target how to
We will create a basic CMake project using a Linux cross-toolchain, add macros to read the version number from a text file, and will then step through the CMake statements in the debugger and show how to modify the version read from the file on-the-fly.īefore you begin, install VisualGDB 5.4 Preview 7 or later.

This tutorial shows how to use VisualGDB to step through the CMake scripts while analyzing CMake configuration problems.
