We just ran into this issue. We “solved” it by using an environment variable that is under control of the presets.
For example, in the “BasePresets.json”:
{
"version": 8,
"configurePresets": [
{
"name": "default",
"hidden": true,
"binaryDir": "$env{BASE_ROOT}/.build/${sourceDirName}",
"toolchainFile": "$env{BASE_ROOT}/where_we_keep_common_stuff/toolchain.cmake",
"environment": {
"BASE_ROOT": "${fileDir}"
}
}
]
}
Then in the project-specific presets we specify “where” the root is from this file by overriding the env-var.
So if it is located one subdirectory away:
{
"version": 8,
"include": ["../BasePresets.json"],
"configurePresets": [
{
"name": "default-inherited",
"inherits": ["default"],
"hidden": true,
"environment": {
"BASE_ROOT": "${fileDir}/.."
}
},
{
"name": "an-actual-preset-for-the-project",
"inherits": ["default-inherited"]
}
]
}