Merge topic 'genexp-no-eval'

634079b86d cmGeneratorExpressionEvaluator: Short-circuit boolean operators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Acked-by: Pavel Solodovnikov <hellyeahdominate@gmail.com>
Merge-request: !8791
This commit is contained in:
Brad King
2023-09-26 13:31:34 +00:00
committed by Kitware Robot
20 changed files with 110 additions and 4 deletions
@@ -195,6 +195,12 @@ Two forms of conditional generator expressions are supported:
if ``condition`` is ``0``. Any other value for ``condition`` results in an
error.
.. versionadded:: 3.28
This generator expression short-circuits such that generator expressions in
``false_string`` will not evaluate when ``condition`` is ``1``, and generator
expressions in ``true_string`` will not evaluate when condition is ``0``.
Typically, the ``condition`` is itself a generator expression. For instance,
the following expression expands to ``DEBUG_MODE`` when the ``Debug``
configuration is used, and the empty string for all other configurations:
@@ -252,6 +258,11 @@ The common boolean logic operators are supported:
``condition`` must be ``0`` or ``1``. The result of the expression is
``0`` if ``condition`` is ``1``, else ``1``.
.. versionadded:: 3.28
Logical operators short-circuit such that generator expressions in the
arguments list will not be evaluated once a return value can be determined.
.. _`Comparison Expressions`:
Primary Comparison Expressions
+5
View File
@@ -0,0 +1,5 @@
genexp-no-eval
--------------
* :manual:`generator expressions <cmake-generator-expressions(7)>`
short-circuit to avoid unnecessary evaluation of parameters.