Configuring a CMake project to build in just the way you want can often be a time intensive process, so in Visual Studio 2017 15.5 preview we have made it easier than ever to import your existing CMake projects and cache configurations into the IDE. You can now import an existing CMakeCache.txt file and Visual Studio will automatically extract customized variables and create a pre-populated CMakeSettings.json file based on them.
Please check out the preview and try out the latest CMake features. If you are just getting started with CMake, follow the link to learn more about CMake support in Visual Studio. We are looking forward to your feedback.
Importing a CMake Project
To get started, we have added a new entry point to open CMake files: File > Open > CMake. From here, you can open a CMake project directly (by selecting a CMakeLists.txt file) or import a CMake cache (by selecting a CMakeCache.txt file):
Navigating to a CMakeCache.txt file activates the import wizard:
When you import a CMake cache, we leave the original cache completely intact. As such, that cache should keep working from the command line or with whatever tool or IDE was used to generate it.
Visual Studio extracts the command line parameters used to create the cache, such as CMake variables, and stores them in a CMakeSettings.json file alongside the project’s root CMakeLists.txt. This file is then used to generate a new cache that Visual Studio uses to build the project.
Keep in mind that not everything in the cache will be imported. Properties such as the generator and the location of the compilers are replaced with defaults known to work well with the IDE.
Your feedback is a critical part of ensuring that we can deliver the best CMake experience. We would love to know how Visual Studio 2017 Preview is working for you. If you have any feedback specific to CMake Tools, please reach out to email@example.com. For general issues please Report a Problem.