OPTIONS_BUILD.txt 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. .. option:: -S <path-to-source>
  2. Path to root directory of the CMake project to build.
  3. .. option:: -B <path-to-build>
  4. Path to directory which CMake will use as the root of build directory.
  5. If the directory doesn't already exist CMake will make it.
  6. .. option:: -C <initial-cache>
  7. Pre-load a script to populate the cache.
  8. When CMake is first run in an empty build tree, it creates a
  9. ``CMakeCache.txt`` file and populates it with customizable settings for
  10. the project. This option may be used to specify a file from which
  11. to load cache entries before the first pass through the project's
  12. CMake listfiles. The loaded entries take priority over the
  13. project's default values. The given file should be a CMake script
  14. containing :command:`set` commands that use the ``CACHE`` option, not a
  15. cache-format file.
  16. References to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`
  17. within the script evaluate to the top-level source and build tree.
  18. .. option:: -D <var>:<type>=<value>, -D <var>=<value>
  19. Create or update a CMake ``CACHE`` entry.
  20. When CMake is first run in an empty build tree, it creates a
  21. ``CMakeCache.txt`` file and populates it with customizable settings for
  22. the project. This option may be used to specify a setting that
  23. takes priority over the project's default value. The option may be
  24. repeated for as many ``CACHE`` entries as desired.
  25. If the ``:<type>`` portion is given it must be one of the types
  26. specified by the :command:`set` command documentation for its
  27. ``CACHE`` signature.
  28. If the ``:<type>`` portion is omitted the entry will be created
  29. with no type if it does not exist with a type already. If a
  30. command in the project sets the type to ``PATH`` or ``FILEPATH``
  31. then the ``<value>`` will be converted to an absolute path.
  32. This option may also be given as a single argument:
  33. ``-D<var>:<type>=<value>`` or ``-D<var>=<value>``.
  34. It's important to note that the order of ``-C`` and ``-D`` arguments is
  35. significant. They will be carried out in the order they are listed, with the
  36. last argument taking precedence over the previous ones. For example, if you
  37. specify ``-DCMAKE_BUILD_TYPE=Debug``, followed by a ``-C`` argument with a
  38. file that calls:
  39. .. code-block:: cmake
  40. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
  41. then the ``-C`` argument will take precedence, and ``CMAKE_BUILD_TYPE`` will
  42. be set to ``Release``. However, if the ``-D`` argument comes after the ``-C``
  43. argument, it will be set to ``Debug``.
  44. If a ``set(... CACHE ...)`` call in the ``-C`` file does not use ``FORCE``,
  45. and a ``-D`` argument sets the same variable, the ``-D`` argument will take
  46. precedence regardless of order because of the nature of non-``FORCE``
  47. ``set(... CACHE ...)`` calls.
  48. .. option:: -U <globbing_expr>
  49. Remove matching entries from CMake ``CACHE``.
  50. This option may be used to remove one or more variables from the
  51. ``CMakeCache.txt`` file, globbing expressions using ``*`` and ``?`` are
  52. supported. The option may be repeated for as many ``CACHE`` entries as
  53. desired.
  54. Use with care, you can make your ``CMakeCache.txt`` non-working.
  55. .. option:: -G <generator-name>
  56. Specify a build system generator.
  57. CMake may support multiple native build systems on certain
  58. platforms. A generator is responsible for generating a particular
  59. build system. Possible generator names are specified in the
  60. :manual:`cmake-generators(7)` manual.
  61. If not specified, CMake checks the :envvar:`CMAKE_GENERATOR` environment
  62. variable and otherwise falls back to a builtin default selection.
  63. .. option:: -T <toolset-spec>
  64. Toolset specification for the generator, if supported.
  65. Some CMake generators support a toolset specification to tell
  66. the native build system how to choose a compiler. See the
  67. :variable:`CMAKE_GENERATOR_TOOLSET` variable for details.
  68. .. option:: -A <platform-name>
  69. Specify platform name if supported by generator.
  70. Some CMake generators support a platform name to be given to the
  71. native build system to choose a compiler or SDK. See the
  72. :variable:`CMAKE_GENERATOR_PLATFORM` variable for details.
  73. .. option:: --toolchain <path-to-file>
  74. .. versionadded:: 3.21
  75. Specify the cross compiling toolchain file, equivalent to setting
  76. :variable:`CMAKE_TOOLCHAIN_FILE` variable. Relative paths are interpreted as
  77. relative to the build directory, and if not found, relative to the source
  78. directory.
  79. .. option:: --install-prefix <directory>
  80. .. versionadded:: 3.21
  81. Specify the installation directory, used by the
  82. :variable:`CMAKE_INSTALL_PREFIX` variable. Must be an absolute path.
  83. .. option:: -Wno-dev
  84. Suppress developer warnings.
  85. Suppress warnings that are meant for the author of the
  86. ``CMakeLists.txt`` files. By default this will also turn off
  87. deprecation warnings.
  88. .. option:: -Wdev
  89. Enable developer warnings.
  90. Enable warnings that are meant for the author of the ``CMakeLists.txt``
  91. files. By default this will also turn on deprecation warnings.
  92. .. option:: -Wdeprecated
  93. Enable deprecated functionality warnings.
  94. Enable warnings for usage of deprecated functionality, that are meant
  95. for the author of the ``CMakeLists.txt`` files.
  96. .. option:: -Wno-deprecated
  97. Suppress deprecated functionality warnings.
  98. Suppress warnings for usage of deprecated functionality, that are meant
  99. for the author of the ``CMakeLists.txt`` files.
  100. .. option:: -Werror=<what>
  101. Treat CMake warnings as errors. ``<what>`` must be one of the following:
  102. ``dev``
  103. Make developer warnings errors.
  104. Make warnings that are meant for the author of the ``CMakeLists.txt`` files
  105. errors. By default this will also turn on deprecated warnings as errors.
  106. ``deprecated``
  107. Make deprecated macro and function warnings errors.
  108. Make warnings for usage of deprecated macros and functions, that are meant
  109. for the author of the ``CMakeLists.txt`` files, errors.
  110. .. option:: -Wno-error=<what>
  111. Do not treat CMake warnings as errors. ``<what>`` must be one of the following:
  112. ``dev``
  113. Make warnings that are meant for the author of the ``CMakeLists.txt`` files not
  114. errors. By default this will also turn off deprecated warnings as errors.
  115. ``deprecated``
  116. Make warnings for usage of deprecated macros and functions, that are meant
  117. for the author of the ``CMakeLists.txt`` files, not errors.