In the documentation for the CMake 3.6.X command line options, the -B
option is indeed not listed:
cmake [<options>] (<path-to-source> | <path-to-existing-build>)
However, the functionality is still there. You can still use -B
to specify a location for the build directory (the current directory is the default). This option, along with -H
for specifying the source directory, were two undocumented command line options for many CMake releases (see this answer).
Because the functionality to support the -B
option was retained, and is still commonly used, CMake added it back into their documentation in CMake 3.13. The latest documentation describes the -B
behavior that has been present all along:
cmake [<options>] -S <path-to-source> -B <path-to-build>
Uses <path-to-build>
as the build tree and <path-to-source>
as the source tree. The specified paths may be absolute or relative to the current working directory. The source tree must contain a CMakeLists.txt
file. The build tree will be created automatically if it does not already exist. For example:
$ cmake -S src -B build