CMakePresets and location of source folder

According to the documentation, the new CMakePresets.json file needs to be located next to the main CMakeLists.txt file.

I now have the usecase, that I would like to generate those CMakePresets.json files (I am using Conan, I install Conan dependencies to given Prefix Paths for a given compiler, so I generate a CMakePresets.json file which contains all this information).
However, since CMake requires this file to be placed next to the CMakeLists.txt file, I also generate a top level CMake file, which has a add_subdirectory to the original file.

Would it be possible that the CMakePresets.json file specifies (optionally) a source folder, if there is no CMakeLists.txt adjacent to it? Or is it too much of a special use case?

2 Likes

Cc: @kyle.edwards