microsoft / vscode-cmake-tools

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

Allow stopping a CMake build launched via workbench.action #3994

Open bmcdonnell-fb opened 2 months ago

bmcdonnell-fb commented 2 months ago

Brief Issue Summary

If I click this extension's "Build" button from the VSCode status bar (at the bottom), that button becomes a "Stop" button while the build is running, giving me the option to abort/cancel it.

image

image

However, when I launch the build from the Ctrl+Shift+B menu (Run Build Task / workbench.action.tasks.build), the button does not change, and there is no apparent way to cancel the build.

image

Can you make the button change in the same way, regardless of how the build is launched?

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

Also, for my info, is there some other way to cancel the build when the button doesn't change?

My project is built with gcc-arm-none-eabi.

Relevant VSCode extensions I'm using:

Evelyn-001 commented 2 months ago

Thanks for reporting this issue. About "cancel the build" option, you could select it by pressing F1 to open menu and type "CMake:Cancel Build". Also, you can click setting icon and click "+" to add a Key binding for it. Please refer to the below video. If miss or misunderstand anything, please let us know. Thanks. 081902

bmcdonnell-fb commented 2 months ago

@Evelyn-001 thanks for the info.

Oddly, it seems the "CMake: Cancel Build" command only works if I launch "CMake: Build" from the F1 menu, or by clicking the "Build" button on the bottom status bar (pictured in my OP above). It does not work if I launch it from any of the options in the Ctrl+Shift+B menu (EDIT: also pictured in my OP). What is that menu, and why are they not all connected?

bmcdonnell-fb commented 2 months ago

When I click on the gear icons next to the options in the Ctrl+Shift+B menu (Run Build Task / workbench.action.tasks.build), I see it brings up my tasks.json file, with the corresponding entry highlighted. And for some reason, there are 3 identical entries for "CMake: build" - not to be confused with the different entry "CMake Build" at the top.

I still don't know how/why this differs from the other ways of starting the build, though.

image

image

Evelyn-001 commented 2 months ago

Thanks for your reply. About Build with CMake Tools, please refer to this document. For defined a build task from the VS Code command palette by running the Tasks: Configure Task command to open the configure_task menu. By choosing the "CMake: build" task, the following task will be created in "${workspaceFolder}/.vscode/tasks.json" file. Did you mean want to "cancel build" for a single defined target? Or did you hit Ctrl+Shift+B and the "CMake Build" menu appeared? Could you please share us a demo video with your clear repro steps? We are looking forward to hearing from you. Thanks. image