mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 13:19:51 -05:00
CMakeDependentOption: improve documentation
This makes it far clearer that `<depends>` is a list up front instead of burying the lede because a list is generally "trivially true" in CMake[1]. Also clarify that `<force>` is only available as a local variable and if queried outside of the "scope" of the `cmake_dependent_option` call, will get the stored user cache value. [1] The exception being when the last entry ends in `-NOTFOUND`. Suggested-by: Rui Oliveira
This commit is contained in:
@@ -16,13 +16,18 @@ conditions are true.
|
|||||||
|
|
||||||
cmake_dependent_option(<option> "<help_text>" <value> <depends> <force>)
|
cmake_dependent_option(<option> "<help_text>" <value> <depends> <force>)
|
||||||
|
|
||||||
Makes ``<option>`` available to the user if ``<depends>`` is true. When
|
Makes ``<option>`` available to the user if the
|
||||||
``<option>`` is available, the given ``<help_text>`` and initial ``<value>``
|
:ref:`semicolon-separated list <CMake Language Lists>` of conditions in
|
||||||
are used. If the ``<depends>`` condition is not true, ``<option>`` will not be
|
``<depends>`` are all true. Otherwise, a local variable named ``<option>``
|
||||||
presented and will always have the value given by ``<force>``. Any value set by
|
is set to ``<force>``.
|
||||||
the user is preserved for when the option is presented again. In case ``<depends>``
|
|
||||||
is a :ref:`semicolon-separated list <CMake Language Lists>`, all elements must
|
When ``<option>`` is available, the given ``<help_text>`` and initial
|
||||||
be true in order to initialize ``<option>`` with ``<value>``.
|
``<value>`` are used. Otherwise, any value set by the user is preserved for
|
||||||
|
when ``<depends>`` is satisfied in the future.
|
||||||
|
|
||||||
|
Note that the ``<option>`` variable only has a value which satisfies the
|
||||||
|
``<depends>`` condition within the scope of the caller because it is a local
|
||||||
|
variable.
|
||||||
|
|
||||||
Example invocation:
|
Example invocation:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user