September 25th, 2026
0 reactions

Visual Studio Code CMake Tools 1.24

CMake Tools 1.24 includes several reliability fixes and productivity improvements. You can run tests from the editor, save preset-backed cache edits as user overrides, and keep source-file lists up to date. See the CMake Tools release page and full changelog for details.

Thank you to the community contributors whose work is included in these updates:

Run and debug CTest tests from the editor

Discovered CTest tests with resolved source locations now have Run and Debug CodeLens actions in the editor. These complement the existing Run and Debug actions and source navigation in the Project Outline. Select Run above a test to build and execute it without switching to the Testing view.

When the test command maps directly to a CMake executable target, Run builds that target and its dependencies instead of the default build target.

The example below has separate cart_tests and shipping_tests executables. Running Cart.AppliesDiscount from CodeLens builds cart_tests and runs that test, without rebuilding the unrelated shipping_tests target.

Run Cart.AppliesDiscount from CodeLens and build its cart_tests target.
Run Cart.AppliesDiscount from CodeLens and build its cart_tests target.

For Debug, build the executable first and have a suitable C++ debugger and debug adapter available. The inline action launches the executable directly, without a build step.

Debugging tests from the Project Outline or Testing view does not require a launch.json.

Keep local cache changes without changing shared presets

A value set in a configure preset can overwrite a manual cache edit on the next configure. The Cache Editor now saves edits to preset-backed variables as overrides in CMakeUserPresets.json.

After configuring with a preset, open CMake: Edit CMake Cache (UI). The new Source column shows preset information alongside cache values. For preset-backed entries, it displays a project- or user-preset label and, when a comparison is available, Matches preset or Changed in cache. Entries without preset information come from the CMake Cache.

For example, BUILD_TESTING starts ON in the project’s cache-demo preset. Turn it OFF and choose SAVE. CMake Tools writes a user-preset override that inherits cache-demo, then configures with it. The shared CMakePresets.json remains unchanged.

In this example, turning BUILD_TESTING off excludes the optional cart_tests target from the build while keeping checkout_app.

Turn off BUILD_TESTING, keep checkout_app, and save the change as a user-preset override.
Turn off BUILD_TESTING, keep checkout_app, and save the change as a user-preset override.

The edited row then shows a user-preset source. Running CMake: Configure again in the same session keeps BUILD_TESTING off. Edits to cache-only variables still go to the cache and are not automatically added to the user preset.

Keep source-file lists up to date

When you create or delete a source file in Explorer, CMake Tools can update its entry in CMakeLists.txt for you. Thanks to @malsyned for the original contribution.

This assistance applies to supported CMakeLists.txt and target arrangements and follows your configured confirmation behavior. The cmake.modifyLists.* settings control target selection, variable handling, and confirmation. Review the resulting changes, especially with generated or complex scripts; this is not a general CMake script rewriter.

Create and delete a source file in Explorer while CMake Tools updates CMakeLists.txt.
Create and delete a source file in Explorer while CMake Tools updates CMakeLists.txt.

What do you think?

Let us know how these changes work with your CMake projects. You can find CMake Tools and the C/C++ extension in the Visual Studio Code Marketplace.

Share feedback by opening an issue or voting on an existing one, or contribute to the CMake Tools repository. You can also leave a comment below, email visualcpp@microsoft.com, or reach us on X or Bluesky.

Author

0 comments