mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 06:40:16 -05:00
CMakeDependentOption: Sync documentation
- Added intro code block with include() showing how to load this module. - Used "command" instead of "macro". - Removed duplicate mention of CMakeDependentOption module in the option() documentation. - Synced captions in examples.
This commit is contained in:
@@ -11,14 +11,11 @@ If no initial ``<value>`` is provided, boolean ``OFF`` is the default value.
|
|||||||
If ``<variable>`` is already set as a normal or cache variable,
|
If ``<variable>`` is already set as a normal or cache variable,
|
||||||
then the command does nothing (see policy :policy:`CMP0077`).
|
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
|
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.
|
value. In CMake script mode, a boolean variable is set with the option value.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* The :module:`CMakeDependentOption` module to specify dependent boolean options
|
* The :module:`CMakeDependentOption` module to specify boolean options that
|
||||||
based on a set of conditions.
|
depend on the values of other options or a set of conditions.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ Modules
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
* The :module:`CMakeDependentOption` module :command:`cmake_dependent_option`
|
* The :module:`CMakeDependentOption` module :command:`cmake_dependent_option`
|
||||||
macro now supports full :ref:`Condition Syntax`.
|
command now supports full :ref:`Condition Syntax`.
|
||||||
See policy :policy:`CMP0127`.
|
See policy :policy:`CMP0127`.
|
||||||
|
|
||||||
* The :module:`FetchContent` module now passes through the
|
* The :module:`FetchContent` module now passes through the
|
||||||
|
|||||||
@@ -10,9 +10,17 @@ default values depend on specified conditions or other options. This helps
|
|||||||
maintain a clean configuration interface by only displaying options that are
|
maintain a clean configuration interface by only displaying options that are
|
||||||
relevant to the current settings.
|
relevant to the current settings.
|
||||||
|
|
||||||
|
Load this module in a CMake project with:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
Commands
|
Commands
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
|
This module provides the following command:
|
||||||
|
|
||||||
.. command:: cmake_dependent_option
|
.. command:: cmake_dependent_option
|
||||||
|
|
||||||
Provides a boolean option that depends on a set of conditions:
|
Provides a boolean option that depends on a set of conditions:
|
||||||
@@ -21,9 +29,9 @@ Commands
|
|||||||
|
|
||||||
cmake_dependent_option(<variable> <help> <value> <condition> <else-value>)
|
cmake_dependent_option(<variable> <help> <value> <condition> <else-value>)
|
||||||
|
|
||||||
This macro creates a boolean ``<variable>`` and makes it available to the user
|
This command creates a boolean ``<variable>`` and makes it available to the
|
||||||
in the GUI (such as :manual:`cmake-gui(1)` or :manual:`ccmake(1)`), if a set
|
user in the GUI (such as :manual:`cmake-gui(1)` or :manual:`ccmake(1)`), if
|
||||||
of conditions evaluates to boolean true.
|
a set of conditions evaluates to boolean true.
|
||||||
|
|
||||||
The arguments are:
|
The arguments are:
|
||||||
|
|
||||||
@@ -83,7 +91,7 @@ Example: Basic Usage
|
|||||||
Using this module in a project to conditionally set an option:
|
Using this module in a project to conditionally set an option:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
:caption: CMakeLists.txt
|
:caption: ``CMakeLists.txt``
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
@@ -96,7 +104,7 @@ Extending the previous example, this demonstrates how the module allows
|
|||||||
user-configurable options based on a condition during the configuration phase:
|
user-configurable options based on a condition during the configuration phase:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
:caption: CMakeLists.txt
|
:caption: ``CMakeLists.txt``
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
@@ -151,7 +159,7 @@ runs, the previous value of ``USE_FOO`` is preserved so that when it becomes
|
|||||||
available again, it retains its last set value.
|
available again, it retains its last set value.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
:caption: CMakeLists.txt
|
:caption: ``CMakeLists.txt``
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
@@ -168,7 +176,7 @@ in the GUI. The value of ``USE_FOO`` is preserved across configuration runs,
|
|||||||
similar to the previous example.
|
similar to the previous example.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
:caption: CMakeLists.txt
|
:caption: ``CMakeLists.txt``
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
@@ -178,7 +186,7 @@ Another example demonstrates how an option can be conditionally available based
|
|||||||
on the target system:
|
on the target system:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
:caption: CMakeLists.txt
|
:caption: ``CMakeLists.txt``
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user