microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.48k stars 455 forks source link

Improve docs - How and where exactly can variables be used? Kit related variables, command substitution, etc. #4010

Open gcampbell-msft opened 3 months ago

gcampbell-msft commented 3 months ago

This issue is a documentation request, rather than having to perform trial and error, users would like better docs on where these things can be used in our extension.

Discussed in https://github.com/microsoft/vscode-cmake-tools/discussions/3379

Originally posted by **HofiOne** October 12, 2023 Hi, I'm trying to use [CMake kits](https://github.com/microsoft/vscode-cmake-tools/blob/0378fdc4a409c63cfb92824f39fe3c23c9d5e0d0/docs/kits.md#cmake-kits) related variables mentioned in [Configure CMake Tools settings](https://github.com/microsoft/vscode-cmake-tools/blob/0378fdc4a409c63cfb92824f39fe3c23c9d5e0d0/docs/cmake-settings.md#configure-cmake-tools-settings) in my tasks.json and settings.json, but seems they are not really defined (yet?) when referencing them. As I understood, the simplest test case should work also, e.g. when I echo the content of the variables from a simple task ``` { "label": "echo", "type": "shell", "command": "echo ${buildKit}, ${generator}, ${workspaceRoot}" }, ``` but using the above test task.json when invoking the `echo` task it prints only the value of the ${workspaceRoot} variable (that I guess comes from the globally defined VSCode variable, not from the CMake Tools defined set) I also tried it in my `settings.json` [Configure CMake Tools settings](https://github.com/microsoft/vscode-cmake-tools/blob/0378fdc4a409c63cfb92824f39fe3c23c9d5e0d0/docs/cmake-settings.md#configure-cmake-tools-settings) mentions that e.g. `cmake.configureArgs` supports substitution, but it seems not to be working either, e.g. having this ``` cmake.configureArgs": [ "-DCMAKE_C_COMPILER=${buildKitVendor}", "-DCMAKE_CXX_COMPILER:FILEPATH=${command:cmake.buildKit}", ], ``` in my `settings.json`, and having this ``` { "label": "CMakeConfigureTaskWorker", "type": "process", "command": "${env:SHELL}", "args": [ "-c", { "value": "\"${config:cmake.cmakePath}\" --install-prefix \"${config:cmake.installPrefix}\" -S\"${workspaceFolder}\" -B\"${config:cmake.buildDirectory}\" -DCMAKE_BUILD_TYPE:STRING=${command:cmake.buildType} ${config:cmake.configureArgs} -G \"Unix Makefiles\" ", "quoting": "strong" } ], ``` in my tasks.json does not contain the proper value in the expanded `${config:cmake.configureArgs}` Where can I reference the [Configure CMake Tools settings](https://github.com/microsoft/vscode-cmake-tools/blob/0378fdc4a409c63cfb92824f39fe3c23c9d5e0d0/docs/cmake-settings.md#configure-cmake-tools-settings) variables exactly? TIA! p.s.: I'm using v1.15.31 on macOS, and yes, I do have the Kits scanned and set up perfectly already via [Scan for kits](https://github.com/microsoft/vscode-cmake-tools/blob/0378fdc4a409c63cfb92824f39fe3c23c9d5e0d0/docs/kits.md#scan-for-kits)