Presets visibility
Hi,
I couldn't find in cmake-presets
documentation what is the supposed visibility of a preset (eg. configurePresets).
Let's say I have a presets file defining a configurePresets
named "common" (hidden) that I want to share across multiple projects (in a submodule for example). In that shared file, I also define non-hidden configurePresets
that I want to be used by each projects as the main configure target, like "win_x64_debug" for example. This preset inherits "common", but it also need inherits a project specific preset to fine tune things (like some cacheVariables
, or other stuff).
The problem is that I cannot reference (in my shared file) a preset that is not directly visible.
Example: CMakePresets.json (main file that sits in the project's folder)
{
"version": 6,
"configurePresets": [
{
"name": "project",
"hidden": true,
"cacheVariables": {
"PROJECT_SPECIFIC_CMAKE_VARIABLE": "TRUE"
}
}
],
"include": [
"submodule/path/CMakeCommonPresets.json"
]
}
The shared presets file (CMakeCommonPresets.json)
{
"version": 6,
"configurePresets": [
{
"name": "common",
"hidden": true,
"cacheVariables": {
"SHARED_CMAKE_VARIABLE": "TRUE"
},
... other common important settings, like generator, toolset, arch, ...
},
{
"name": "win_x64_debug",
"inherits": [
"common",
"project"
]
}
],
}
Using Visual Studio
or Visual Code
is working fine, as I suspect both software are using a global visibility map for presets (eg. as soon as a preset is defined, it is globally visible and accessible for inheritance). But using cmake --list-presets
is not working, as I suspect cmake is building a visibility map per include file.
The documentation doesn't clearly say who is right or wrong (or I didn't find it) regarding visibility. It looks like an implementation detail but it has a huge importance here. Would it be possible to clearly define the include behavior
so all softwares behave the same, and if possible to define it so the visibility is global so we can solve this kind of setup?
Thanks, Chris