microsoft / microsoft/vscode-cmake-tools

Multi-target debug cwd configuration

Open
#1,101 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: debug/launch
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

My 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported workspace layout and the CMakeLists.txt files; reproduce how CMake Tools chooses the debug cwd for multiple targets. Trace the existing debug configuration path, with completion defined as each target using its project's out directory and the behavior covered by a regression test or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.