1build_command 2------------- 3 4Get a command line to build the current project. 5This is mainly intended for internal use by the :module:`CTest` module. 6 7.. code-block:: cmake 8 9 build_command(<variable> 10 [CONFIGURATION <config>] 11 [PARALLEL_LEVEL <parallel>] 12 [TARGET <target>] 13 [PROJECT_NAME <projname>] # legacy, causes warning 14 ) 15 16Sets the given ``<variable>`` to a command-line string of the form:: 17 18 <cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i] 19 20where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line 21tool, and ``<config>``, ``<parallel>`` and ``<target>`` are the values 22provided to the ``CONFIGURATION``, ``PARALLEL_LEVEL`` and ``TARGET`` 23options, if any. The trailing ``-- -i`` option is added for 24:ref:`Makefile Generators` if policy :policy:`CMP0061` is not set to 25``NEW``. 26 27When invoked, this ``cmake --build`` command line will launch the 28underlying build system tool. 29 30.. versionadded:: 3.21 31 The ``PARALLEL_LEVEL`` argument can be used to set the ``--parallel`` 32 flag. 33 34.. code-block:: cmake 35 36 build_command(<cachevariable> <makecommand>) 37 38This second signature is deprecated, but still available for backwards 39compatibility. Use the first signature instead. 40 41It sets the given ``<cachevariable>`` to a command-line string as 42above but without the ``--target`` option. 43The ``<makecommand>`` is ignored but should be the full path to 44devenv, nmake, make or one of the end user build tools 45for legacy invocations. 46 47.. note:: 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. 52