Files
cmake/Tests/RunCMake/GeneratorExpression/ListTransformApplyNested-check.cmake
Mickaël Germain 0f6e8ded1d GenEx: add $<LIST:TRANSFORM,...,APPLY,body> action
Add an APPLY action to $<LIST:TRANSFORM> that evaluates an arbitrary <body>
once per selected element, with $<_0> bound to the element, so a list can be
mapped through any generator expression at generate time.  Unlike the
configure-time list(TRANSFORM ... APPLY <function>) command, the genex form has
no side effects and returns the body's value directly, and a list-valued result
expands into multiple elements.

The body evaluates in its own binding scope, so nested APPLY actions can shadow
$<_0>, and context-sensitive state it observes (such as target dependencies)
still propagates to the enclosing expression.  APPLY accepts the same
AT/FOR/REGEX selectors as the canned actions.

Issue: #27892
2026-06-21 18:05:53 -07:00

13 lines
528 B
CMake

file(READ "${RunCMake_TEST_BINARY_DIR}/nested.txt" actual)
file(READ "${RunCMake_TEST_BINARY_DIR}/expected.txt" expected)
string(STRIP "${actual}" actual)
string(STRIP "${expected}" expected)
# The nested APPLY (outer binds each target, inner uppercases each include dir)
# must equal the explicit per-target expansion exactly.
if(NOT actual STREQUAL expected)
set(RunCMake_TEST_FAILED
"nested APPLY output does not match the explicit expansion:\n"
" actual: [${actual}]\n"
" expected: [${expected}]")
endif()