-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Minimal CMake
By :

CMake presets are a way to share common configuration options across a project. They’re used in much the same way we’ve been relying on our .sh
and .bat
files but provide tighter integration with CMake, and can be used with other tools such as Visual Studio Code, Visual Studio, and CLion (a cross-platform C/C++ development environment).
To get started with CMake presets, we need to create a file called CMakePresets.json
at the root of our project. CMake presets are simply a JavaScript Object Notation (JSON) document with an object ({}
) as the root. A CMakePresets.json
file has multiple sections for each stage of a CMake build (configure, build, test, package, and more). To begin with, we’ll focus on the configure and build portions, but we will return to our CMakePresets.json
file in later chapters as the project continues to mature.
Authoring CMake preset files
Authoring CMake preset files can sometimes be a challenge due to their...