cmake/Help/command/option.rst

19 lines
615 B
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
option
------
2022-08-04 22:12:04 +02:00
Provide a boolean option that the user can optionally select.
2014-08-03 19:52:23 +02:00
2019-11-11 23:01:05 +01:00
.. code-block:: cmake
2014-08-03 19:52:23 +02:00
2019-11-11 23:01:05 +01:00
option(<variable> "<help_text>" [value])
2014-08-03 19:52:23 +02:00
2022-08-04 22:12:04 +02:00
If no initial ``<value>`` is provided, boolean ``OFF`` is the default value.
2020-08-30 11:54:41 +02:00
If ``<variable>`` is already set as a normal or cache variable,
2019-11-11 23:01:05 +01:00
then the command does nothing (see policy :policy:`CMP0077`).
2014-08-03 19:52:23 +02:00
2022-08-04 22:12:04 +02:00
For options that depend on the values of other options, see
2015-11-17 17:22:37 +01:00
the module help for :module:`CMakeDependentOption`.
2022-08-04 22:12:04 +02:00
In CMake project mode, a boolean cache variable is created with the option
value. In CMake script mode, a boolean variable is set with the option value.