mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
This updates the module documentation to be more synced with other modules. Also, this module on the first glance doesn't do what most people might think. Because when condition evaluates to false, internal cache remains with the same value, and a local variable is created with the value provided in the last argument. - Command arguments described separately and their placeholders renamed to more intuitive names. - More examples added, starting with a very basic syntax usage to more complex ones, each described in more details. - Each example has include() added to be more clear that this is a module command.
25 lines
748 B
ReStructuredText
25 lines
748 B
ReStructuredText
option
|
|
------
|
|
|
|
Provide a boolean option that the user can optionally select.
|
|
|
|
.. code-block:: cmake
|
|
|
|
option(<variable> "<help_text>" [value])
|
|
|
|
If no initial ``<value>`` is provided, boolean ``OFF`` is the default value.
|
|
If ``<variable>`` is already set as a normal or cache variable,
|
|
then the command does nothing (see policy :policy:`CMP0077`).
|
|
|
|
For options that depend on the values of other options, see
|
|
the module help for :module:`CMakeDependentOption`.
|
|
|
|
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.
|
|
|
|
See Also
|
|
^^^^^^^^
|
|
|
|
* The :module:`CMakeDependentOption` module to specify dependent boolean options
|
|
based on a set of conditions.
|