Presets: Search parent directories if source directory has no presets file
Similar to how tools like clang-format
work, if the user includes the --presets
option on their CMake command line but the project's source directory has no CMakePresets.json
or CMakeUserPresets.json
file, it would be really convenient if cmake
would search recursively the parent directories for CMakeUserPresets.json
(but not CMakePresets.json
). If you have all your project sources under a common directory, you could put a CMakeUserPresets.json
file in that common directory and you could make use of it from any of the projects with no extra effort.
I'm still on the fence about whether to search recursively for a CMakeUserPresets.json
file if the project source directory has just a CMakePresets.json
file but no CMakeUserPresets.json
file in it.
We should not search recursively for a CMakePresets.json
file since that should always be provided by the project.