function(test_strip input expected) string(GENEX_STRIP "${input}" strip) if (NOT strip STREQUAL expected) message(FATAL_ERROR "message(GENEXP_STRIP \"${input}\") evaluated to \"${strip}\" expected \"${expected}\"") endif() endfunction() test_strip( # Simple case "$" "" ) test_strip( # LHS contains generator expression "$<$:NDEBUG>;DEBUG" "DEBUG" ) test_strip( # RHS contains generator expression "$>" "" ) test_strip( # Empty and unfinished expressions "$<>$<$<>" "$<$<>" ) test_strip( # Multiple independent expressions "$ / $" " / " ) test_strip( # Multiple : in one expression "$<1:2:3>" "" ) test_strip( # Multiple case "1$2$:$>,TRUE,FALSE>3" "123" ) test_strip( # No : inside of : "$<1:$>1" "1" )