presets: CMAKE_BINARY_DIR not resolved in script mode
Trying to workaround the current limitation described at #24827, I was thinking of using the --preset
option in -P
script mode to dump CMake state, hoping script execution would happened after internal preset resolving. It seems to somehow work but not completely, eg. for CMAKE_BINARY_DIR
...
Given the following CMakePresets.json
file:
{
"version": 4,
"configurePresets": [
{
"name": "chantal",
"binaryDir": "${sourceDir}/build"
}
]
}
And the following simple CMakeDumpPreset.cmake
script:
message("CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
message("CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")
CMake 3.26.3 gives:
$ cmake --preset=chantal -P CMakeDumpPreset.cmake
CMAKE_SOURCE_DIR=~/src/regis
CMAKE_BINARY_DIR=~/src/regis
Where I would have expected:
CMAKE_SOURCE_DIR=~/src/regis
CMAKE_BINARY_DIR=~/src/regis/build