option.rst 748 B

123456789101112131415161718192021222324
  1. option
  2. ------
  3. Provide a boolean option that the user can optionally select.
  4. .. code-block:: cmake
  5. option(<variable> "<help_text>" [value])
  6. If no initial ``<value>`` is provided, boolean ``OFF`` is the default value.
  7. If ``<variable>`` is already set as a normal or cache variable,
  8. then the command does nothing (see policy :policy:`CMP0077`).
  9. For options that depend on the values of other options, see
  10. the module help for :module:`CMakeDependentOption`.
  11. In CMake project mode, a boolean cache variable is created with the option
  12. value. In CMake script mode, a boolean variable is set with the option value.
  13. See Also
  14. ^^^^^^^^
  15. * The :module:`CMakeDependentOption` module to specify dependent boolean options
  16. based on a set of conditions.