cmake <path-to-source | path-to-existing-build>

Command-line interface of the cross-platform buildsystem generator CMake


path-to-source | path-to-existing-buildfolders


--buildProject binary directory to be built and must be first. This is required unless a preset is specified
--installProject binary directory to install. This is required and must be first
--openOpen the generated project in the associated application. This is only supported by some generators
-PProcess the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache is not modified. If variables are defined using -D, this must be done before the -P argument
-ECMake provides builtin command-line tools through the signature


-S <path-to-source>Path to root directory of the CMake project to build
-B <path-to-source>Path to directory which CMake will use as the root of build directory. If the directory doesn't already exist CMake will make it
-C <initial-cache>Pre-load a script to populate the cache
-D <key value pair>Create or update a CMake CACHE entry
-U <globbing_expr>Remove matching entries from CMake CACHE
-G <generator-name>Specify a build system generator
-T <toolset-spec>Toolset specification for the generator, if supported
-A <platform-name>Specify platform name if supported by generator
toolchain <path-to-file>Specify the cross compiling toolchain file, equivalent to setting CMAKE_TOOLCHAIN_FILE variable
--install-prefix <directory>Specify the installation directory, used by the CMAKE_INSTALL_PREFIX variable. Must be an absolute path
-Wno-devSuppress developer warnings
-WdevEnable developer warnings
-Werror <type>Enable the type of warnings
-Wno-error <type>Disable the type of warnings
-WdeprecatedEnable deprecated functionality warnings
-Wno-deprecatedSuppress deprecated functionality warnings
-LList non-advanced cached-variables
-NView mode only
--graphviz [file]Generate graphviz of dependencies
--system-information [file]Dump information about this system
--log-level <log-level>Set log-level
--log-contextEnable the message() command outputting context attached to each message
--debug-trycompileDo not delete the try_compile() build tree
--debug-outputPut cmake in a debug mode
--debug-findPut cmake find commands in a debug mode
--tracePut cmake in trace mode
--trace-expandPut cmake in trace mode with variables expanded
--trace-format <format>Put cmake in trace mode and sets the trace output format
--trace-source <file>Put cmake in trace mode, but output only lines of a specified file
--trace-redirect <file>Put cmake in trace mode and redirect trace output to a file instead of stderr
--warn-uninitializedWarn about uninitialized values
--warn-unused-varsDoes nothing. In CMake versions 3.2 and below this enabled warnings about unused variables. In CMake versions 3.3 through 3.18 the option was broken. In CMake 3.19 and above the option has been removed
--no-warn-unused-cliDon't warn about command line options. Don't find variables that are declared on the command line, but not used
--check-system-varsFind problems with variable usage in system files
--preset <preset>Reads a preset from <path-to-source>/CMakePresets.json and <path-to-source>/CMakeUserPresets.json. The preset may specify the generator and the build directory, and a list of variables and other arguments to pass to CMake. The current working directory must contain CMake preset files. The CMake GUI can also recognize CMakePresets.json and CMakeUserPresets.json files
--list-presets [type]Lists the available presets