Is there a way for a single preset to apply different settings based on a condition?
For example, I would like cmake --preset default
to choose the appropriate vcpkg triplet for the current OS.
"configurePresets": [
{
"name": "windows",
"hidden": true,
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "macos",
"hidden": true,
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-macos"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "default",
"binaryDir": "${sourceDir}/build/default",
"generator": "Ninja",
"inherits": [
"windows",
"macos"
]
}
]
This does not work as ādefaultā winds up with conflicting condition objects and just picks the first (I think)
{
"name": "default",
"binaryDir": "${sourceDir}/build/default",
"generator": "Ninja",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "default",
"binaryDir": "${sourceDir}/build/default",
"generator": "Ninja",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-macos"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
}
This does not work as you may not have two presets with the same name, even if one is disabled.
Is this something that is currently possible, or planned for the future?