String-TIMESTAMP-TimeZone.cmake 704 B

12345678910111213141516171819202122
  1. string(TIMESTAMP output "%z")
  2. STRING(LENGTH output output_length)
  3. message("~${output}~")
  4. set(expected_output_length 6)
  5. if(NOT(${output_length} EQUAL ${expected_output_length}))
  6. message(FATAL_ERROR "expected ${expected_output_length} entries in output with all specifiers; found ${output_length}")
  7. endif()
  8. string(SUBSTRING ${output} 0 1 output0)
  9. string(SUBSTRING ${output} 4 1 output4)
  10. if(NOT((${output0} STREQUAL "-") OR (${output0} STREQUAL "+")))
  11. message(FATAL_ERROR "expected output[0] equ '+' or '-'; found: '${output0}'")
  12. endif()
  13. if(NOT((${output4} STREQUAL "0") OR (${output4} STREQUAL "5")))
  14. message(FATAL_ERROR "expected output[4] equ '0' or '5'; found: '${output4}'")
  15. endif()