4 Get a command line to build the current project.
5 This is mainly intended for internal use by the :module:`CTest` module.
9 build_command(<variable>
10 [CONFIGURATION <config>]
11 [PARALLEL_LEVEL <parallel>]
13 [PROJECT_NAME <projname>] # legacy, causes warning
16 Sets the given ``<variable>`` to a command-line string of the form::
18 <cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i]
20 where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
21 tool, and ``<config>``, ``<parallel>`` and ``<target>`` are the values
22 provided to the ``CONFIGURATION``, ``PARALLEL_LEVEL`` and ``TARGET``
23 options, if any. The trailing ``-- -i`` option is added for
24 :ref:`Makefile Generators` if policy :policy:`CMP0061` is not set to
27 When invoked, this ``cmake --build`` command line will launch the
28 underlying build system tool.
30 .. versionadded:: 3.21
31 The ``PARALLEL_LEVEL`` argument can be used to set the ``--parallel``
36 build_command(<cachevariable> <makecommand>)
38 This second signature is deprecated, but still available for backwards
39 compatibility. Use the first signature instead.
41 It sets the given ``<cachevariable>`` to a command-line string as
42 above but without the ``--target`` option.
43 The ``<makecommand>`` is ignored but should be the full path to
44 devenv, nmake, make or one of the end user build tools
45 for legacy invocations.
48 In CMake versions prior to 3.0 this command returned a command
49 line that directly invokes the native build tool for the current
50 generator. Their implementation of the ``PROJECT_NAME`` option
51 had no useful effects, so CMake now warns on use of the option.