Multi-target debug cwd configuration
See original GitHub issueMy workspace is structured like so:
${workspaceFolder}
|----- CMakeLists.txt
|
|----- build/
|
|----- projects/
|----- projectA/
| |----- src/
| |----- out/
| |----- resources/
| |----- CMakeLists.txt
|
... (3 more identically structured projects)
When debugging, I want CMake Tools to set the cwd to each project’s out
directory because I distribute the files from resources/
to out/
and access them using relative paths.
The cwd is currently set to ${workspaceFolder}
which means none of the resources are found.
I have tried putting this in each project’s CMakeLists.txt
but it did not work
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
Any suggestions?
Edit: ${CMAKE_BINARY_DIR}
is set to ${PROJECT_SOURCE_DIR}/out
in each project’s CMake Lists.txt
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Debugging in Visual Studio Code
In order to start a debug session, first select the configuration named Launch Program using the Configuration dropdown in the Run and Debug...
Read more >Setting up multi-target (compound) debugging in VS Code
Debug your renderer process. Configure VS Code to debug both processes at the same time using multi-target (compound) debugging!
Read more >How to seamlessly multi target Electron debug with VSCode ...
I suggest to change the value of the "protocol" attribute in the top most debug configuration to "legacy" (assuming that the protocol is...
Read more >Debug both javascript and c# in ASP.NET Core MVC using VS ...
VS Code will automatically start multi-target debugging. You will want to start an "attach to chrome" session (see below for configuration ...
Read more >Debug ASP.NET Core Blazor WebAssembly - Microsoft Learn
Start Without Debugging [ Ctrl + F5 (Windows) or ⌘ + F5 (macOS)] isn't supported. When the app is run in Debug configuration,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We can mark this as a feature request. In the meantime, you can use the
cmake.debugConfig
object to override certain debugger settings like “cwd” (current working directory).This is not ideal for a project with multiple targets since you’ll have to change the cwd each time you change debug targets, but it can get you by until the feature is implemented.
You can use the following in your settings.json without having to modify the cwd each time:
However, this does not work for non-debug launches. Any ideas?