I have two different projects in my CMakeLists.txt file.
I'm using a configuration like this in my launch.json
file inside the `.vscode' folder:
{
"name": "Launch main project",
"type": "cppdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
}
],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
trouble is, that the vscode-cmake-tools
only recognizes the test project, and not my main project.
is there any way to tell vscode and the extention to run the main_project to run the other project?
this is my cmake file:
cmake_minimum_required(VERSION 3.2.0...3.5)
project(main_project VERSION 0.1.0)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
add_subdirectory( tests ) # this is the test project
add_executable(main_project main.cpp)
target_include_directories(main_project PRIVATE ${YOUR_DIRECTORY})
Haven't found a way to do it. The "solution" I found was just to launch each one separately, and run a build task before each of them.
And in the tasks.json: