SeparateArgumentsTest.cmake.in 839 B

12345678910111213141516171819202122232425
  1. set(old_out "a b c")
  2. separate_arguments(old_out)
  3. set(old_exp "a;b;;c")
  4. set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
  5. set(unix_exp "a;b c;d e;\;; '\";';\"")
  6. separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}")
  7. set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
  8. set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
  9. separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}")
  10. foreach(mode old unix windows)
  11. if(NOT "${${mode}_out}" STREQUAL "${${mode}_exp}")
  12. message(FATAL_ERROR "separate_arguments ${mode}-style failed. "
  13. "Expected\n [${${mode}_exp}]\nbut got\n [${${mode}_out}]\n")
  14. endif()
  15. endforeach()
  16. set(nothing)
  17. separate_arguments(nothing)
  18. if(DEFINED nothing)
  19. message(FATAL_ERROR "separate_arguments null-case failed: "
  20. "nothing=[${nothing}]")
  21. endif()