What’s New in CMake for VS Code
The latest version of CMake tools is now available for download in the VS Code Marketplace or using the .vsix file. We have been working hard on improving the CMake experience and are excited to share some new features and improvements for users starting in version 1.11.
‘CMake’ task provider updates
We have added more options to the build task and more commands for the “cmake” task type so you don’t have to manually type up shell tasks. Tasks make it easier to automate your workflows. With our new task provider commands, you can easily create workflows that include configuration, build, install, test, clean, and clean rebuild tasks.
Selecting targets now supported
Now, in your build task, users can specify multiple targets and it is included as a parameter in the task template. Before, this was a single active target selected in the status bar. Now, you can select any target independent of the state of the extension. An example of a build task to target multiple targets (“main” and “sum”) using this feature is seen below.
New CMake tasks supported
To run and configure tasks, press
Ctrl+Shift+P to pull up the Command Palette and select the appropriate option for your tasks.
To create a new task, first select “Configure Task” from the dropdown. This will populate the view below in a C++ project.
You can select the appropriate task, which will populate the task template in the tasks.json file. We recommend updating the “detail” field in the JSON object for your CMake tasks so that you can differentiate the tasks from the drop-down.
Once the task is created, you can select this task to run using “Run Task” from the Command Palette, which will run the shell commands for the created task.
We are working to add even more support for the ‘CMake’ task provider, including adding “args” and “environment” specification for your tasks.
What do you think?
Download the CMake Tools extension for Visual Studio Code and let us know what you think. If you run into any issues or have any suggestions, please report them in the Issues section of our GitHub repository. We would love to hear how you are using CMake tasks. Comment below, or reach us via email at email@example.com or via Twitter at @VisualC.