Help: hyperlink $<_0> and configure-time commands in $<LIST> docs

Several $<LIST> doc references appeared as plain literal text: the bound
operand $<_0>, the configure-time list(TRANSFORM ... APPLY) command (the
TRANSFORM APPLY action title and prose), and the $<LIST:TRANSFORM,...,APPLY,body>
example in the $<_0> definition.  Use the :genex: and :command: roles so they
hyperlink to their definitions, matching the sibling canned actions and the
rest of the manual.

Issue: #27892
This commit is contained in:
Mickaël Germain
2026-06-25 11:20:52 -04:00
committed by Brad King
parent 092edb6860
commit 0b5a172c22
2 changed files with 13 additions and 13 deletions
+8 -10
View File
@@ -952,21 +952,19 @@ List Transformations
element instead of the beginning of each repeated search.
See policy :policy:`CMP0186`.
``APPLY``
:command:`APPLY <list(TRANSFORM_APPLY)>`
Transform each selected element by evaluating an arbitrary generator
expression ``<body>`` once per element. Within ``<body>``, the bound
operand ``$<_0>`` expands to the current element. Unlike the
configure-time ``list(TRANSFORM ... APPLY <function>)`` command, the
genex form returns the body's value directly and has no side effects. A
list-valued body result expands into multiple elements, like any other
list-valued generator expression.
operand :genex:`$<_0>` expands to the current element. Unlike the
configure-time :command:`list(TRANSFORM APPLY) <list(TRANSFORM_APPLY)>`
command, the genex form returns the body's value directly and has no side
effects. A list-valued body result expands into multiple elements, like
any other list-valued generator expression.
.. code-block:: cmake
$<LIST:TRANSFORM,list,APPLY,body[,SELECTOR]>
See ``$<_0>`` below for the bound operand.
.. versionadded:: 4.5
``SELECTOR`` determines which items of the list will be transformed.
@@ -1113,8 +1111,8 @@ Bound Operands
generator expression that evaluates a ``<body>`` once for each value it
supplies, with ``$<_0>`` expanding to that value.
For example, ``$<LIST:TRANSFORM,...,APPLY,body>`` evaluates ``body`` once per
list element with ``$<_0>`` bound to the current element.
For example, :genex:`$<LIST:TRANSFORM,...,APPLY,body>` evaluates ``body``
once per list element with ``$<_0>`` bound to the current element.
``$<_0>`` is only valid inside the body of a binding operation. Using it
anywhere else is an error.
+5 -3
View File
@@ -159,13 +159,14 @@ static cm::optional<std::vector<bool>> EvaluatePredicateMask(
GeneratorExpressionContent const* content,
cmGeneratorExpressionDAGChecker* dagChecker)
{
cm::optional<std::vector<bool>> result;
std::vector<bool> mask;
mask.reserve(list.size());
for (auto const& element : list) {
std::string r =
EvaluateBodyWithBoundOperand(predicateBody, element, eval, dagChecker);
if (eval->HadError) {
return cm::nullopt;
return result;
}
if (r == "1") {
mask.push_back(true);
@@ -178,10 +179,11 @@ static cm::optional<std::vector<bool>> EvaluatePredicateMask(
", PREDICATE body must evaluate to \"0\" or \"1\", but "
"evaluated to \"",
r, "\"."));
return cm::nullopt;
return result;
}
}
return mask;
result = std::move(mask);
return result;
}
static const struct ZeroNode : public cmGeneratorExpressionNode