-HΒΆ
Note
Has been replaced in 3.13 with the official source directory flag of -S.
Add -H<path-to-source-tree> to set directory with CMakeLists.txt.
This internal option is not documented but
widely used by community.
There must be no spaces between -H and <path-to-source-tree>
(otherwise option will be interpreted as synonym to --help). Always must
be used with -B option. Example:
cmake -H. -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.
Warning
PowerShell will modify arguments and put the space between -H and ..
You can protect argument by quoting it:
cmake '-H.' -B_builds
See also
CMake mailing list