ctest_build.rst 3.0 KB

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