GenexpStrip.cmake 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. function(test_strip input expected)
  2. string(GENEX_STRIP "${input}" strip)
  3. if (NOT strip STREQUAL expected)
  4. message(FATAL_ERROR "message(GENEXP_STRIP \"${input}\")
  5. evaluated to \"${strip}\"
  6. expected \"${expected}\"")
  7. endif()
  8. endfunction()
  9. test_strip( # Simple case
  10. "$<BOOL:1>"
  11. ""
  12. )
  13. test_strip( # LHS contains generator expression
  14. "$<$<CONFIG:Release>:NDEBUG>;DEBUG"
  15. "DEBUG"
  16. )
  17. test_strip( # RHS contains generator expression
  18. "$<AND:1,$<BOOL:TRUE>>"
  19. ""
  20. )
  21. test_strip( # Empty and unfinished expressions
  22. "$<>$<$<>"
  23. "$<$<>"
  24. )
  25. test_strip( # Multiple independent expressions
  26. "$<IF:TRUE,TRUE,FALSE> / $<IF:TRUE,TRUE,FALSE>"
  27. " / "
  28. )
  29. test_strip( # Multiple : in one expression
  30. "$<1:2:3>"
  31. ""
  32. )
  33. test_strip( # Multiple case
  34. "1$<AND:1,0>2$<IF:$<$<BOOL:1>:$<CONFIG:RELEASE>>,TRUE,FALSE>3"
  35. "123"
  36. )
  37. test_strip( # No : inside of :
  38. "$<1:$<SEMICOLON>>1"
  39. "1"
  40. )