set(mylist one "$<1:two\;three>" four "$") list(TRANSFORM mylist GENEX_STRIP OUTPUT_VARIABLE output) if (NOT output STREQUAL "one;;four;") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one;;four;\"") endif() set(mylist "one $" "$<1:two\;three>-$" "$four" "$") unset(output) list(TRANSFORM mylist GENEX_STRIP AT 1 3 OUTPUT_VARIABLE output) if (NOT output STREQUAL "one $;-;$four;") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $;-;$four;\"") endif() unset(output) list(TRANSFORM mylist GENEX_STRIP AT 1 -2 OUTPUT_VARIABLE output) if (NOT output STREQUAL "one $;-;four;$") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $;-;four;$\"") endif() unset(output) list(TRANSFORM mylist GENEX_STRIP FOR 1 2 OUTPUT_VARIABLE output) if (NOT output STREQUAL "one $;-;four;$") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $;-;four;$\"") endif() unset(output) list(TRANSFORM mylist GENEX_STRIP FOR 1 -1 OUTPUT_VARIABLE output) if (NOT output STREQUAL "one $;-;four;") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one $;-;four;\"") endif() unset(output) list(TRANSFORM mylist GENEX_STRIP FOR 0 -1 2 OUTPUT_VARIABLE output) if (NOT output STREQUAL "one ;$<1:two;three>-$;four;$") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one ;$<1:two;three>-$;four;$\"") endif() unset(output) list(TRANSFORM mylist GENEX_STRIP REGEX "(D|G)>" OUTPUT_VARIABLE output) if (NOT output STREQUAL "one ;-;$four;$") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${output}\", expected is \"one ;-;$four;$\"") endif() unset(output) list(TRANSFORM mylist GENEX_STRIP REGEX "(D|G)>") if (NOT mylist STREQUAL "one ;-;$four;$") message (FATAL_ERROR "TRANSFORM(GENEX_STRIP) is \"${mylist}\", expected is \"one ;-;$four;$\"") endif()