Easily add, delete and rename files and goals in CMake projects

Working with CMake projects in Visual Studio 2019 16.5 Preview 2 is now easier than ever. Now you can add, delete, and rename source files and targets in your CMake projects from the IDE without manually editing the CMake scripts. When adding or deleting files using Solution Explorer, Visual Studio automatically edits your CMake project. You can also add, delete and rename project goals using CMake Targets View in Solution Explorer.

image

More details under the cut.

C and C ++ source files


Visual Studio now tracks C and C ++ source files as they are added, renamed, or removed from Solution Explorer, automatically modifying the underlying CMake project. This function is enabled by default in Visual Studio 2019 16.5 Preview 2, but if you want Visual Studio not to change the project automatically, you can disable this function in Tools> Options> CMake, “Enable automatic CMake script modification ...”:

image

Objectives and recommendations


CMake Targets View now offers even more features. From here, in addition to adding and deleting files, you can add, rename and delete targets. You can access the CMake Targets View by clicking the Solution Explorer drop-down menu to the right of the Home button:

image

If you have previously worked with the solutions generated by CMake, the presented one will look familiar to you, but unlike the generated solution, you can change the basic CMake project directly in the IDE. Visual Studio currently supports changing the following:

1. Adding, deleting, renaming source files to goals:

image

2. Adding, deleting, renaming goals in a CMake project:

image

image

3. Viewing and creating links between goals in a project:

image

image

Ambiguous solution


In some cases, there may be several places where it makes sense to add the source file to the CMake script. When this happens, Visual Studio will ask you where you want to make the changes and display a preview of the proposed changes:

image

Share your opinion


Please try Visual Studio 2019 16.5 Preview 2 and share your opinion with us, because it is really important for us! The best way to contact us and report a problem or make a proposal is to contact the Developer Community, or use the “ Report a Problem ” and “Suggest a Feature” tools . These methods allow us to easily track problems and suggestions, and you will receive the latest news on the progress of their implementation. Also feel free to leave comments on the original article and ask questions at cmake@microsoft.com.

Source: https://habr.com/ru/post/undefined/


All Articles