build_command.rst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. build_command
  2. -------------
  3. Get a command line to build the current project.
  4. This is mainly intended for internal use by the :module:`CTest` module.
  5. .. code-block:: cmake
  6. build_command(<variable>
  7. [CONFIGURATION <config>]
  8. [TARGET <target>]
  9. [PROJECT_NAME <projname>] # legacy, causes warning
  10. )
  11. Sets the given ``<variable>`` to a command-line string of the form::
  12. <cmake> --build . [--config <config>] [--target <target>] [-- -i]
  13. where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
  14. tool, and ``<config>`` and ``<target>`` are the values provided to the
  15. ``CONFIGURATION`` and ``TARGET`` options, if any. The trailing ``-- -i``
  16. option is added for Makefile generators.
  17. When invoked, this ``cmake --build`` command line will launch the
  18. underlying build system tool.
  19. .. code-block:: cmake
  20. build_command(<cachevariable> <makecommand>)
  21. This second signature is deprecated, but still available for backwards
  22. compatibility. Use the first signature instead.
  23. It sets the given ``<cachevariable>`` to a command-line string as
  24. above but without the ``--config`` or ``--target`` options.
  25. The ``<makecommand>`` is ignored but should be the full path to
  26. msdev, devenv, nmake, make or one of the end user build tools
  27. for legacy invocations.
  28. .. note::
  29. In CMake versions prior to 3.0 this command returned a command
  30. line that directly invokes the native build tool for the current
  31. generator. Their implementation of the ``PROJECT_NAME`` option
  32. had no useful effects, so CMake now warns on use of the option.