The CMake Presets System in CPPython provides a sophisticated three-tier architecture for managing CMake configurations across different build scenarios, dependency providers, and user customizations.
The preset system is designed around three distinct layers:
User CMakePresets.json
↓ (includes)
CPPython Presets (.cppython/cppython.json)
↓ (includes)
Provider Presets (.cppython/providers/*.json)Each layer serves a specific purpose and maintains clear separation of concerns.
The provider layer contains presets generated by dependency management tools like Conan or vcpkg. These presets include tool-specific configurations and are completely managed by CPPython.
Each provider generates 4 configure presets:
{provider}-base-
Hidden preset containing common configuration shared by all other presets. Includes toolchain files and top-level includes.
{provider}-default-
Hidden preset inheriting from base. No specific build type set, making it suitable for multi-config generators.
{provider}-release-
Hidden preset inheriting from base with
CMAKE_BUILD_TYPE=Releasefor single-config generators. {provider}-debug-
Hidden preset inheriting from base with
CMAKE_BUILD_TYPE=Debugfor single-config generators.
The CPPython layer standardizes provider configurations and creates both configure and build presets. This layer serves as the primary interface between provider-specific settings and user configurations.
The CPPython layer generates 3 configure presets:
default-
Public preset inheriting from
{provider}-default. Designed for multi-config generators. release-
Public preset inheriting from
{provider}-release. Optimized for single-config Release builds. debug-
Public preset inheriting from
{provider}-debug. Optimized for single-config Debug builds.
The CPPython layer generates 4 build presets to handle both single-config and multi-config generators:
multi-release-
Uses the
defaultconfigure preset withconfiguration: "Release". For multi-config generators. multi-debug-
Uses the
defaultconfigure preset withconfiguration: "Debug". For multi-config generators. release-
Uses the
releaseconfigure preset withconfiguration: "Release". For single-config generators. debug-
Uses the
debugconfigure preset withconfiguration: "Debug". For single-config generators.