Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To configure the debug target of a CMake library in Visual Studio, follow these steps:

  1. Open the CMakeLists.txt file of the library in Visual Studio.

  2. Click on the "CMake" option in the menu bar and select "Change CMake Settings".

  3. This will open the "CMakeSettings.json" file. Locate the "configurations" section and find the debug configuration.

  4. Within the debug configuration, add the following line:

"buildRoot": "${workspaceRoot}/build/${name}_Debug"

This line specifies the directory where the debug build will be stored.

  1. Save the file and close it.

  2. Open the project properties window by right-clicking on the project in the Solution Explorer and selecting "Properties".

  3. Select the "Debugging" tab and enter the following command in the "Command" field:

"${buildRoot}/<your_library>.dll"

This command specifies which library to run for debugging.

  1. Save the project properties and build the library.

Now, when you start a debug session in Visual Studio, it will use the specified library for debugging.