-SΒΆ

Add -S <path-to-source-tree> to set directory with CMakeLists.txt. This option was added in CMake 3.13 and replaces the the undocumented and internal variable -H. This option can be used independently of -B.

cmake -S . -B _builds

Use current directory as a source tree (i.e. start with ./CMakeLists.txt) and put generated files to the ./_builds folder.

Path to this directory will be saved in CMAKE_SOURCE_DIR variable.

See also