Mapping lists in generator expressions

Ok, that works! Thank you. It even works recursively!:

set(targets picolibc::picolibc ZLIB::ZLIB)

function(escape_generator_expression var)
    string(REPLACE ">" "__ANGLE_R__" ${var} "${${var}}")
    string(REPLACE "$" "$<1:$>" ${var} "${${var}}")
    string(REPLACE "," "$<COMMA>" ${var} "${${var}}")
    string(REPLACE "__ANGLE_R__" "$<ANGLE-R>" ${var} "${${var}}")
    return(PROPAGATE ${var})
endfunction()

set(prop "INTERFACE_INCLUDE_DIRECTORIES")
set(get_prop "$<TARGET_PROPERTY:\\1,${prop}>")
escape_generator_expression(get_prop)
escape_generator_expression(get_prop)

set(expr "$<GENEX_EVAL:$<GENEX_EVAL:$<LIST:TRANSFORM,${targets},REPLACE,(.+),${get_prop}>>>")
2 Likes