microsoft / microsoft/vscode-cmake-tools

Command substitution for current working directory

Open
#2,594 1 comment 0 reactions 0 assignees View on GitHub
enhancement Feature: settings quick fix
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

I am currently using command substitution in my `launch.json` file as follows
```
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "test_template",
"type": "gdb",
"request": "launch",
"target": "${command:cmake.launchTargetPath}",
"arguments": "",
"stopAtEntry": false,
"cwd":"${command:cmake.launchTargetDirectory}",
}
]
}
```

The issue I have is that, in my cmake file, I am setting the working directory for my tests as `${CMAKE_CURRENT_SOURCE_DIR}`.
Now in this case `cmake.launchTargetDirectory` doesn't really help me as it points to the path in the build directory and not in the source tree, resulting in my test failing as it relies on relative paths to find input data. Is there an easy way to access `CMAKE_CURRENT_SOURCE_DIR` in the command substitution path ?

Contributor guide

Open the contributing guide

Research direction

Start with the launch.json configuration and the cmake.launchTargetDirectory command substitution described in the issue; trace how command substitutions are resolved and how CMake exposes CMAKE_CURRENT_SOURCE_DIR. Done means a launch configuration can resolve the source-tree working directory for tests that use relative input paths, with coverage for the new substitution behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.