What’s New in CMake for VS Code

Sinem Akinci

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.  

Example CMake build task with multiple targets

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.  

Command Palette drop-down with CMake tasks selected

To create a new task, first select “Configure Task” from the dropdown. This will populate the view below in a C++ project.  

CMake tasks that the user can select to configure

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. 

Example CMake tasks to select to run

Coming Soon

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 visualcpp@microsoft.com or via Twitter at @VisualC. 


Discussion is closed.

Feedback usabilla icon