mirror of
https://github.com/Kitware/CMake.git
synced 2026-06-30 19:57:41 +00:00
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
8 lines
312 B
CMake
8 lines
312 B
CMake
file(READ "${RunCMake_TEST_BINARY_DIR}/tp.txt" actual)
|
|
string(STRIP "${actual}" actual)
|
|
# flatMap: libA -> /a/inc (1 dir), libB -> /b/inc1;/b/inc2 (2 dirs) => 3 items.
|
|
if(NOT actual STREQUAL "/a/inc;/b/inc1;/b/inc2")
|
|
set(RunCMake_TEST_FAILED
|
|
"unexpected APPLY target-property output: [${actual}]")
|
|
endif()
|