option.rst 662 B

123456789101112131415161718192021
  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. In CMake project mode, a boolean cache variable is created with the option
  10. value. In CMake script mode, a boolean variable is set with the option value.
  11. See Also
  12. ^^^^^^^^
  13. * The :module:`CMakeDependentOption` module to specify boolean options that
  14. depend on the values of other options or a set of conditions.