Files
CMake/Tests/RunCMake/CTestCommandExpandLists/expandGeneratorExpressionResult.cmake
Sergey Bobrenok e791ffac61 add_test: Add COMMAND_EXPAND_LISTS option
Add a `COMMAND_EXPAND_LISTS` option to the `add_test` command to cause
`;`-separated lists produced by generator expressions to be expanded
into multiple arguments.  The `add_custom_command` command already
has such an option.

Fixes: #17284
2019-06-07 13:14:29 -04:00

20 lines
385 B
CMake

include(CTest)
set(cmp_args "1ARG=COMMAND_EXPAND_LISTS" "2ARG=test" "3ARG=outfile"
"4ARG=content")
set(AARGS "")
foreach(arg IN LISTS cmp_args)
list(APPEND AARGS "-DA${arg}")
endforeach()
add_test(
NAME CommandExpandList
COMMAND ${CMAKE_COMMAND} ${AARGS} -V
"-DB$<JOIN:${cmp_args},;-DB>"
"-P" "${CMAKE_CURRENT_LIST_DIR}/compare_options.cmake"
COMMAND_EXPAND_LISTS
)