CMake Presets Configuration Precedence for User-Level Files
0 reputation · 04 Mar 2021, 04:05 UTC
CLion integrates with CMakePresets.json to allow toolchain, generator, and cache variable definitions to be managed outside of the IDE's internal profile settings. With the release of CMake 3.27, the standard for user-specific presets transitioned from UserPresets.json to CMakeUserPresets.json.
In environments where legacy projects coexist with newer standards, both the deprecated UserPresets.json and the current CMakeUserPresets.json may exist in the project root. While the CMake CLI maintains backward compatibility, it is unclear how CLion resolves these files when populating the CMake profile list under Settings | Build, Execution, Deployment | CMake.
Specifically, if both files define presets with the same name or overlapping cache variables, the IDE's resolution order is not documented. There is also uncertainty regarding whether the IDE re-evaluates preset condition fields immediately upon an external file edit or if a manual project reload is required to update the available profiles.
- Which user-level preset file takes precedence when both
UserPresets.jsonandCMakeUserPresets.jsonare present? - Does CLion merge these files or ignore the deprecated filename entirely?
- Are preset conditions re-evaluated dynamically during external file changes?