CMake Presets vs CLion CMake Profiles: which governs toolchain selection when both target the same configure step?
0 reputation · 07 Aug 2021, 15:55 UTC
Goal
Establish a single source of truth for toolchain and generator selection so that local CLion builds and CI pipelines produce identical CMakeCache.txt output.
Constraint
The project uses a versioned CMakePresets.json checked into VCS to define a Docker-based toolchain for reproducible builds. Developers also create personal CLion CMake Profiles in the IDE for UI convenience. Both mechanisms can specify generator, toolchain, and cache variables for the same configure preset.
Uncertainty
CLion merges preset and profile values with profile values taking precedence in the UI, but cache invalidation and the values displayed in the CMake tool window become inconsistent after switching toolchains. It is unclear whether the preset or the profile ultimately controls the active toolchain during configure, and whether the merge behavior is stable across CLion releases.
Questions
- When a CMake preset and a CLion profile both define a toolchain for the same configure step, which source deterministically wins during configure and cache generation?
- Does the precedence order change when the active profile is switched without a full cache reset?
- Is there a documented way to lock toolchain selection to the preset so that profile edits cannot override it?