build_command.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 :ref:`Makefile Generators` if policy :policy:`CMP0061`
  17. is not set to ``NEW``.
  18. When invoked, this ``cmake --build`` command line will launch the
  19. underlying build system tool.
  20. .. code-block:: cmake
  21. build_command(<cachevariable> <makecommand>)
  22. This second signature is deprecated, but still available for backwards
  23. compatibility. Use the first signature instead.
  24. It sets the given ``<cachevariable>`` to a command-line string as
  25. above but without the ``--target`` option.
  26. The ``<makecommand>`` is ignored but should be the full path to
  27. devenv, nmake, make or one of the end user build tools
  28. for legacy invocations.
  29. .. note::
  30. In CMake versions prior to 3.0 this command returned a command
  31. line that directly invokes the native build tool for the current
  32. generator. Their implementation of the ``PROJECT_NAME`` option
  33. had no useful effects, so CMake now warns on use of the option.