Using command variables in task with CMake Tools
See original GitHub issueBrief Issue Summary
Tried to use this in tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "CMake Build",
"command": "${command:cmake.build}",
"type": "shell",
"group": "build",
"problemMatcher": []
}
]
}
Or
{
"version": "2.0.0",
"tasks": [
{
"label": "CMake Build All",
"command": "${command:cmake.buildAll}",
"type": "shell",
"group": "build",
"problemMatcher": []
}
]
}
Expected:
CMake Tools to build project as when running “CMake: Build” or “CMake: BuildAll” command from command palette.
Apparent Behavior:
Got error: For “CMake Build”:
[rollbar] Unhandled exception: Unhandled Promise rejection: build TypeError: Cannot read property 'fsPath' of undefined {}
For “CMake Build All”:
[rollbar] Unhandled exception: Unhandled Promise rejection: buildAll TypeError: str.replace is not a function {}
After “CMake Build All” task CMake tools becomes broken, and even from CMake side panel gives an error:
A CMake task is already running. Stop it before trying to build.
Platform and Versions
- Operating System: Linux Mint 19
- CMake Version: 3.5.1
- VSCode Version: 1.38.1
- CMake Tools Extension Version: 1.3.1
- Compiler/Toolchain: arm-none-eabi-gcc 4.8
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:16 (6 by maintainers)
Top Results From Across the Web
Configuring CMake Tools - vector Of bool
Configuring CMake Tools¶. CMake Tools supports a variety of settings that can be set at the user or workspace level via VSCode's settings.json...
Read more >Custom Commands — Mastering CMake
CMake supports these additional tasks using the add_custom_command and ... lists many variables that are useful for custom commands that need to reference ......
Read more >Get started with CMake Tools on Linux - Visual Studio Code
In this tutorial, you'll use the CMake Tools extension for Visual Studio Code to ... Open a Terminal window and enter the following...
Read more >CMake@1 - CMake v1 task | Microsoft Learn
In this article. Syntax; Inputs; Output variables; Remarks; Requirements. Use this task to build with the CMake cross-platform build system.
Read more >How to run Cmake in Visual Studio Code using tasks
{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRoot}" ...
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
I think the example at the beginning of the issue (which you used) is the old way of attempting to do this. Try to apply the below changes to your example and let us know how that works: “command”: “build”, “type”: “cmake”,
Also, if(or when) command variable feature becomes working, it would be nice to publish the command IDs for CMake Tools somewhere in documentation. Because I wasn’t able to find it anywhere except CMake Tools’s sources.