ctest_build.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ctest_build
  2. -----------
  3. Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`.
  4. .. code-block:: cmake
  5. ctest_build([BUILD <build-dir>] [APPEND]
  6. [CONFIGURATION <config>]
  7. [PARALLEL_LEVEL <parallel>]
  8. [FLAGS <flags>]
  9. [PROJECT_NAME <project-name>]
  10. [TARGET <target-name>]
  11. [NUMBER_ERRORS <num-err-var>]
  12. [NUMBER_WARNINGS <num-warn-var>]
  13. [RETURN_VALUE <result-var>]
  14. [CAPTURE_CMAKE_ERROR <result-var>]
  15. )
  16. Build the project and store results in ``Build.xml``
  17. for submission with the :command:`ctest_submit` command.
  18. The :variable:`CTEST_BUILD_COMMAND` variable may be set to explicitly
  19. specify the build command line. Otherwise the build command line is
  20. computed automatically based on the options given.
  21. The options are:
  22. ``BUILD <build-dir>``
  23. Specify the top-level build directory. If not given, the
  24. :variable:`CTEST_BINARY_DIRECTORY` variable is used.
  25. ``APPEND``
  26. Mark ``Build.xml`` for append to results previously submitted to a
  27. dashboard server since the last :command:`ctest_start` call.
  28. Append semantics are defined by the dashboard server in use.
  29. This does *not* cause results to be appended to a ``.xml`` file
  30. produced by a previous call to this command.
  31. ``CONFIGURATION <config>``
  32. Specify the build configuration (e.g. ``Debug``). If not
  33. specified the ``CTEST_BUILD_CONFIGURATION`` variable will be checked.
  34. Otherwise the :option:`-C \<cfg\> <ctest -C>` option given to the
  35. :manual:`ctest(1)` command will be used, if any.
  36. ``PARALLEL_LEVEL <parallel>``
  37. .. versionadded:: 3.21
  38. Specify the parallel level of the underlying build system. If not
  39. specified, the :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment
  40. variable will be checked.
  41. ``FLAGS <flags>``
  42. Pass additional arguments to the underlying build command.
  43. If not specified the ``CTEST_BUILD_FLAGS`` variable will be checked.
  44. This can, e.g., be used to trigger a parallel build using the
  45. ``-j`` option of ``make``. See the :module:`ProcessorCount` module
  46. for an example.
  47. ``PROJECT_NAME <project-name>``
  48. Ignored since CMake 3.0.
  49. .. versionchanged:: 3.14
  50. This value is no longer required.
  51. ``TARGET <target-name>``
  52. Specify the name of a target to build. If not specified the
  53. ``CTEST_BUILD_TARGET`` variable will be checked. Otherwise the
  54. default target will be built. This is the "all" target
  55. (called ``ALL_BUILD`` in :ref:`Visual Studio Generators`).
  56. ``NUMBER_ERRORS <num-err-var>``
  57. Store the number of build errors detected in the given variable.
  58. ``NUMBER_WARNINGS <num-warn-var>``
  59. Store the number of build warnings detected in the given variable.
  60. ``RETURN_VALUE <result-var>``
  61. Store the return value of the native build tool in the given variable.
  62. ``CAPTURE_CMAKE_ERROR <result-var>``
  63. .. versionadded:: 3.7
  64. Store in the ``<result-var>`` variable -1 if there are any errors running
  65. the command and prevent ctest from returning non-zero if an error occurs.
  66. ``QUIET``
  67. .. versionadded:: 3.3
  68. Suppress any CTest-specific non-error output that would have been
  69. printed to the console otherwise. The summary of warnings / errors,
  70. as well as the output from the native build tool is unaffected by
  71. this option.