vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Add command substitution for getLaunchTarget so the current debug target name can be consumed in tasks.json

Open hwmaier opened this issue 4 years ago • 7 comments

This is a feature request.

Currently a list of CMake variables are available for command substitution in task commands, for example cmake.buildTargetName. Refer to https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/cmake-settings.md

While the build target name is exposed as substitution, the corresponding debug target name is not.

It would be beneficial to add a substitution for getLaunchTarget so the current debug target name is also available and can be consumed in tasks. This is very useful to support utility targets like code signing or embedded flash programming.

Please note, the getLaunchTargetFilename (equivalent to CMake API nameOnDisk) is already exposed, but this is a different value than the itself launchTarget (CMake API value name) and has the file extension .exe or .elf appended.

hwmaier avatar May 21 '21 00:05 hwmaier

Good idea, thank you for the feature request.

andreeis avatar May 21 '21 14:05 andreeis

This would be a very simple change and this is a good example PR that added similar new commands in the past (in case anyone would be interested to implement this). https://github.com/microsoft/vscode-cmake-tools/pull/1488

andreeis avatar May 24 '21 22:05 andreeis

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.

github-actions[bot] avatar Oct 19 '23 16:10 github-actions[bot]

Hi Garrett, has this been implemented?

hwmaier avatar Oct 02 '24 23:10 hwmaier

@hwmaier From what I can tell, we currently have the three commands:

cmake.getLaunchTargetPath cmake.getLaunchTargetDirectory cmake.getLaunchTargetFileName

Do these work for you? Re-opening this issue until this is confirmed.

gcampbell-msft avatar Oct 04 '24 09:10 gcampbell-msft

cmake.getLaunchTargetPath cmake.getLaunchTargetDirectory cmake.getLaunchTargetFileName

Do these work for you? Re-opening this issue until this is confirmed.

Thank you for re-opening. I am aware of those, but as stated in the initial post, these three values have extensions (.exe) and paths added and are not the same value as the target name.

The idea is the have an equivalent to cmake.buildTargetName which exposes the selected launch target name not its underlaying file name.

hwmaier avatar Oct 04 '24 23:10 hwmaier

@hwmaier Got it, thanks for the additional information.

gcampbell-msft avatar Oct 07 '24 09:10 gcampbell-msft