CMake: Build Target from tasks.json to support compound debugging
- I want to debug multiple individual executables together (server, client) that have no build time dependencies.
- I have
compoundsinlaunch.jsonthat works for this. - For each executable in my compound, I'd like to have
preLaunchTaskinlaunch.jsonto make sure those executables are rebuilt before debugging. - In the preLaunchTasks I would like to be able to perform
CMake: Build Target, so that I can build those targets.
There does not seem to be a way to perform CMake: Build Target from a task in tasks.json. Is there a way? Or does this need a new feature in CMake Tools? Thanks!
Thank you for suggesting this feature idea. Currently, the command "CMake: Build Target" can't be hooked up to tasks.json, only "CMake: Build" (which builds the default target if defined or ALL otherwise). You could use this one for now, even if this would cause the rebuild of targets that you don't need.
Building all is not always an option. Building all of a large project can take a really long time. Some targets might not build at all, because the project has not yet been fully ported to a new environment.
I worked around this by using shell command cmake --build .. --config .. --target .. -- -j .. in tasks.json, essentially copying what CMake: Build Target outputs when it executes. But I need to copy paste an entry for every target.
This issue is now marked as 'stale-old' due to there being no activity on it for the past 720 days. Unless the 'stale-old' label is removed or the issue is commented on, this will be remain open for at least 14 days and then it may be closed. If you would like to make this issue exempt from getting stale, please add the 'stale-exempt' label.
Yes, please make this work:
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "CMake: build",
"command": "build",
"targets": [
"${command:cmake.launchTarget}"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "CMake template build task"
}
],
}
It should be as easy as just making the target name available (instead of the full path).
I am also running in this issue, would love to use the build target from tasks