summaryrefslogtreecommitdiff
path: root/Tests/CTestTestStopTime/GetDate.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CTestTestStopTime/GetDate.cmake')
-rw-r--r--Tests/CTestTestStopTime/GetDate.cmake234
1 files changed, 117 insertions, 117 deletions
diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake
index b793306..60f1e0c 100644
--- a/Tests/CTestTestStopTime/GetDate.cmake
+++ b/Tests/CTestTestStopTime/GetDate.cmake
@@ -1,6 +1,6 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.2)
+cmake_minimum_required(VERSION 2.2)
-MACRO(GET_DATE)
+macro(GET_DATE)
#
# All macro arguments are optional.
# If there's an ARGV0, use it as GD_PREFIX. Default = 'GD_'
@@ -34,20 +34,20 @@ MACRO(GET_DATE)
# If there's an ARGV0, use it as GD_PREFIX:
#
- SET(GD_PREFIX "GD_")
- IF(NOT "${ARGV0}" STREQUAL "")
- SET(GD_PREFIX "${ARGV0}")
- ENDIF(NOT "${ARGV0}" STREQUAL "")
- IF(NOT "${GD_PREFIX}" STREQUAL "GD_")
- SET(${GD_PREFIX}PREFIX "${GD_PREFIX}")
- ENDIF(NOT "${GD_PREFIX}" STREQUAL "GD_")
+ set(GD_PREFIX "GD_")
+ if(NOT "${ARGV0}" STREQUAL "")
+ set(GD_PREFIX "${ARGV0}")
+ endif()
+ if(NOT "${GD_PREFIX}" STREQUAL "GD_")
+ set(${GD_PREFIX}PREFIX "${GD_PREFIX}")
+ endif()
# If there's an ARGV1, use it as ${GD_PREFIX}VERBOSE:
#
- SET(${GD_PREFIX}VERBOSE "0")
- IF(NOT "${ARGV1}" STREQUAL "")
- SET(${GD_PREFIX}VERBOSE "${ARGV1}")
- ENDIF(NOT "${ARGV1}" STREQUAL "")
+ set(${GD_PREFIX}VERBOSE "0")
+ if(NOT "${ARGV1}" STREQUAL "")
+ set(${GD_PREFIX}VERBOSE "${ARGV1}")
+ endif()
# Retrieve the current date and time in the format:
#
@@ -57,58 +57,58 @@ MACRO(GET_DATE)
# Use "echo %DATE% %TIME%" on Windows.
# Otherwise, try "date" as implemented on most Unix flavors.
#
- IF(WIN32)
+ if(WIN32)
#
# Use "cmd" shell with %DATE% and %TIME% support...
# May need adjustment in different locales or for custom date/time formats
# set in the Windows Control Panel.
#
- SET(${GD_PREFIX}CMD "cmd")
- SET(${GD_PREFIX}ARGS "/c echo %DATE% %TIME%")
- ELSE(WIN32)
+ set(${GD_PREFIX}CMD "cmd")
+ set(${GD_PREFIX}ARGS "/c echo %DATE% %TIME%")
+ else()
#
# Match the format returned by default in US English Windows:
#
- SET(${GD_PREFIX}CMD "date")
- SET(${GD_PREFIX}ARGS "\"+%a %m/%d/%Y %H:%M:%S.00\"")
- ENDIF(WIN32)
+ set(${GD_PREFIX}CMD "date")
+ set(${GD_PREFIX}ARGS "\"+%a %m/%d/%Y %H:%M:%S.00\"")
+ endif()
- EXEC_PROGRAM("${${GD_PREFIX}CMD}" "." ARGS "${${GD_PREFIX}ARGS}"
+ exec_program("${${GD_PREFIX}CMD}" "." ARGS "${${GD_PREFIX}ARGS}"
OUTPUT_VARIABLE ${GD_PREFIX}OV RETURN_VALUE ${GD_PREFIX}RV
)
- IF(${GD_PREFIX}VERBOSE)
- MESSAGE(STATUS "")
- MESSAGE(STATUS "<GET_DATE>")
- MESSAGE(STATUS "")
- MESSAGE(STATUS "GD_PREFIX='${GD_PREFIX}'")
- IF(NOT "${GD_PREFIX}" STREQUAL "GD_")
- MESSAGE(STATUS "${GD_PREFIX}PREFIX='${${GD_PREFIX}PREFIX}'")
- ENDIF(NOT "${GD_PREFIX}" STREQUAL "GD_")
- MESSAGE(STATUS "${GD_PREFIX}VERBOSE='${${GD_PREFIX}VERBOSE}'")
- MESSAGE(STATUS "")
- MESSAGE(STATUS "${GD_PREFIX}CMD='${${GD_PREFIX}CMD}'")
- MESSAGE(STATUS "${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}'")
- MESSAGE(STATUS "${GD_PREFIX}OV='${${GD_PREFIX}OV}'")
- MESSAGE(STATUS "${GD_PREFIX}RV='${${GD_PREFIX}RV}'")
- MESSAGE(STATUS "")
- ENDIF(${GD_PREFIX}VERBOSE)
-
- IF("${${GD_PREFIX}RV}" STREQUAL "0")
+ if(${GD_PREFIX}VERBOSE)
+ message(STATUS "")
+ message(STATUS "<GET_DATE>")
+ message(STATUS "")
+ message(STATUS "GD_PREFIX='${GD_PREFIX}'")
+ if(NOT "${GD_PREFIX}" STREQUAL "GD_")
+ message(STATUS "${GD_PREFIX}PREFIX='${${GD_PREFIX}PREFIX}'")
+ endif()
+ message(STATUS "${GD_PREFIX}VERBOSE='${${GD_PREFIX}VERBOSE}'")
+ message(STATUS "")
+ message(STATUS "${GD_PREFIX}CMD='${${GD_PREFIX}CMD}'")
+ message(STATUS "${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}'")
+ message(STATUS "${GD_PREFIX}OV='${${GD_PREFIX}OV}'")
+ message(STATUS "${GD_PREFIX}RV='${${GD_PREFIX}RV}'")
+ message(STATUS "")
+ endif()
+
+ if("${${GD_PREFIX}RV}" STREQUAL "0")
#
# Extract eight individual components by matching a regex with paren groupings.
# Use the replace functionality and \\1 thru \\8 to extract components.
#
- SET(${GD_PREFIX}REGEX "([^ ]+) +([^/]+)/([^/]+)/([^ ]+) +([^:]+):([^:]+):([^\\.]+)\\.(.*)")
+ set(${GD_PREFIX}REGEX "([^ ]+) +([^/]+)/([^/]+)/([^ ]+) +([^:]+):([^:]+):([^\\.]+)\\.(.*)")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\1" ${GD_PREFIX}DAY_OF_WEEK "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\2" ${GD_PREFIX}MONTH "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\3" ${GD_PREFIX}DAY "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\4" ${GD_PREFIX}YEAR "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\5" ${GD_PREFIX}HOUR "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\6" ${GD_PREFIX}MINUTE "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\7" ${GD_PREFIX}SECOND "${${GD_PREFIX}OV}")
- STRING(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\8" ${GD_PREFIX}FRACTIONAL_SECOND "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\1" ${GD_PREFIX}DAY_OF_WEEK "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\2" ${GD_PREFIX}MONTH "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\3" ${GD_PREFIX}DAY "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\4" ${GD_PREFIX}YEAR "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\5" ${GD_PREFIX}HOUR "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\6" ${GD_PREFIX}MINUTE "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\7" ${GD_PREFIX}SECOND "${${GD_PREFIX}OV}")
+ string(REGEX REPLACE "${${GD_PREFIX}REGEX}" "\\8" ${GD_PREFIX}FRACTIONAL_SECOND "${${GD_PREFIX}OV}")
#
# Verify that extracted components don't have anything obviously
@@ -117,93 +117,93 @@ MACRO(GET_DATE)
# Expecting a four digit year:
#
- IF(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$")
- MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}' is not a four digit number...")
- ENDIF(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$")
+ if(NOT "${${GD_PREFIX}YEAR}" MATCHES "^[0-9][0-9][0-9][0-9]$")
+ message(STATUS "WARNING: Extracted ${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}' is not a four digit number...")
+ endif()
# Expecting month to be <= 12:
#
- IF(${${GD_PREFIX}MONTH} GREATER 12)
- MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}' is greater than 12!")
- ENDIF(${${GD_PREFIX}MONTH} GREATER 12)
+ if(${${GD_PREFIX}MONTH} GREATER 12)
+ message(STATUS "WARNING: Extracted ${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}' is greater than 12!")
+ endif()
# Expecting day to be <= 31:
#
- IF(${${GD_PREFIX}DAY} GREATER 31)
- MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}DAY='${${GD_PREFIX}DAY}' is greater than 31!")
- ENDIF(${${GD_PREFIX}DAY} GREATER 31)
+ if(${${GD_PREFIX}DAY} GREATER 31)
+ message(STATUS "WARNING: Extracted ${GD_PREFIX}DAY='${${GD_PREFIX}DAY}' is greater than 31!")
+ endif()
# Expecting hour to be <= 23:
#
- IF(${${GD_PREFIX}HOUR} GREATER 23)
- MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}' is greater than 23!")
- ENDIF(${${GD_PREFIX}HOUR} GREATER 23)
+ if(${${GD_PREFIX}HOUR} GREATER 23)
+ message(STATUS "WARNING: Extracted ${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}' is greater than 23!")
+ endif()
# Expecting minute to be <= 59:
#
- IF(${${GD_PREFIX}MINUTE} GREATER 59)
- MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}' is greater than 59!")
- ENDIF(${${GD_PREFIX}MINUTE} GREATER 59)
+ if(${${GD_PREFIX}MINUTE} GREATER 59)
+ message(STATUS "WARNING: Extracted ${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}' is greater than 59!")
+ endif()
# Expecting second to be <= 59:
#
- IF(${${GD_PREFIX}SECOND} GREATER 59)
- MESSAGE(STATUS "WARNING: Extracted ${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}' is greater than 59!")
- ENDIF(${${GD_PREFIX}SECOND} GREATER 59)
+ if(${${GD_PREFIX}SECOND} GREATER 59)
+ message(STATUS "WARNING: Extracted ${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}' is greater than 59!")
+ endif()
# If individual components are single digit,
# prepend a leading zero:
#
- IF("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$")
- SET(${GD_PREFIX}YEAR "0${${GD_PREFIX}YEAR}")
- ENDIF("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$")
- IF("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$")
- SET(${GD_PREFIX}MONTH "0${${GD_PREFIX}MONTH}")
- ENDIF("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$")
- IF("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$")
- SET(${GD_PREFIX}DAY "0${${GD_PREFIX}DAY}")
- ENDIF("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$")
- IF("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$")
- SET(${GD_PREFIX}HOUR "0${${GD_PREFIX}HOUR}")
- ENDIF("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$")
- IF("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$")
- SET(${GD_PREFIX}MINUTE "0${${GD_PREFIX}MINUTE}")
- ENDIF("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$")
- IF("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$")
- SET(${GD_PREFIX}SECOND "0${${GD_PREFIX}SECOND}")
- ENDIF("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$")
-
- IF(${GD_PREFIX}VERBOSE)
- MESSAGE(STATUS "${GD_PREFIX}REGEX='${${GD_PREFIX}REGEX}'")
- MESSAGE(STATUS "${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}'")
- MESSAGE(STATUS "${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}'")
- MESSAGE(STATUS "${GD_PREFIX}DAY='${${GD_PREFIX}DAY}'")
- MESSAGE(STATUS "${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}'")
- MESSAGE(STATUS "${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}'")
- MESSAGE(STATUS "${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}'")
- MESSAGE(STATUS "${GD_PREFIX}FRACTIONAL_SECOND='${${GD_PREFIX}FRACTIONAL_SECOND}'")
- MESSAGE(STATUS "${GD_PREFIX}DAY_OF_WEEK='${${GD_PREFIX}DAY_OF_WEEK}'")
- MESSAGE(STATUS "")
- MESSAGE(STATUS "Counters that change...")
- MESSAGE(STATUS "")
- MESSAGE(STATUS "...very very quickly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}${${GD_PREFIX}FRACTIONAL_SECOND}")
- MESSAGE(STATUS " every second : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}")
- MESSAGE(STATUS " daily : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}")
- MESSAGE(STATUS " monthly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}")
- MESSAGE(STATUS " annually : ${${GD_PREFIX}YEAR}")
- MESSAGE(STATUS "")
- ENDIF(${GD_PREFIX}VERBOSE)
- ELSE("${${GD_PREFIX}RV}" STREQUAL "0")
- MESSAGE(SEND_ERROR "ERROR: MACRO(GET_DATE) failed. ${GD_PREFIX}CMD='${${GD_PREFIX}CMD}' ${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}' ${GD_PREFIX}OV='${${GD_PREFIX}OV}' ${GD_PREFIX}RV='${${GD_PREFIX}RV}'")
- ENDIF("${${GD_PREFIX}RV}" STREQUAL "0")
-
- IF(${GD_PREFIX}VERBOSE)
- MESSAGE(STATUS "</GET_DATE>")
- MESSAGE(STATUS "")
- ENDIF(${GD_PREFIX}VERBOSE)
-ENDMACRO(GET_DATE)
-
-MACRO(ADD_SECONDS sec)
+ if("${${GD_PREFIX}YEAR}" MATCHES "^[0-9]$")
+ set(${GD_PREFIX}YEAR "0${${GD_PREFIX}YEAR}")
+ endif()
+ if("${${GD_PREFIX}MONTH}" MATCHES "^[0-9]$")
+ set(${GD_PREFIX}MONTH "0${${GD_PREFIX}MONTH}")
+ endif()
+ if("${${GD_PREFIX}DAY}" MATCHES "^[0-9]$")
+ set(${GD_PREFIX}DAY "0${${GD_PREFIX}DAY}")
+ endif()
+ if("${${GD_PREFIX}HOUR}" MATCHES "^[0-9]$")
+ set(${GD_PREFIX}HOUR "0${${GD_PREFIX}HOUR}")
+ endif()
+ if("${${GD_PREFIX}MINUTE}" MATCHES "^[0-9]$")
+ set(${GD_PREFIX}MINUTE "0${${GD_PREFIX}MINUTE}")
+ endif()
+ if("${${GD_PREFIX}SECOND}" MATCHES "^[0-9]$")
+ set(${GD_PREFIX}SECOND "0${${GD_PREFIX}SECOND}")
+ endif()
+
+ if(${GD_PREFIX}VERBOSE)
+ message(STATUS "${GD_PREFIX}REGEX='${${GD_PREFIX}REGEX}'")
+ message(STATUS "${GD_PREFIX}YEAR='${${GD_PREFIX}YEAR}'")
+ message(STATUS "${GD_PREFIX}MONTH='${${GD_PREFIX}MONTH}'")
+ message(STATUS "${GD_PREFIX}DAY='${${GD_PREFIX}DAY}'")
+ message(STATUS "${GD_PREFIX}HOUR='${${GD_PREFIX}HOUR}'")
+ message(STATUS "${GD_PREFIX}MINUTE='${${GD_PREFIX}MINUTE}'")
+ message(STATUS "${GD_PREFIX}SECOND='${${GD_PREFIX}SECOND}'")
+ message(STATUS "${GD_PREFIX}FRACTIONAL_SECOND='${${GD_PREFIX}FRACTIONAL_SECOND}'")
+ message(STATUS "${GD_PREFIX}DAY_OF_WEEK='${${GD_PREFIX}DAY_OF_WEEK}'")
+ message(STATUS "")
+ message(STATUS "Counters that change...")
+ message(STATUS "")
+ message(STATUS "...very very quickly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}${${GD_PREFIX}FRACTIONAL_SECOND}")
+ message(STATUS " every second : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}${${GD_PREFIX}HOUR}${${GD_PREFIX}MINUTE}${${GD_PREFIX}SECOND}")
+ message(STATUS " daily : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}${${GD_PREFIX}DAY}")
+ message(STATUS " monthly : ${${GD_PREFIX}YEAR}${${GD_PREFIX}MONTH}")
+ message(STATUS " annually : ${${GD_PREFIX}YEAR}")
+ message(STATUS "")
+ endif()
+ else()
+ message(SEND_ERROR "ERROR: macro(GET_DATE) failed. ${GD_PREFIX}CMD='${${GD_PREFIX}CMD}' ${GD_PREFIX}ARGS='${${GD_PREFIX}ARGS}' ${GD_PREFIX}OV='${${GD_PREFIX}OV}' ${GD_PREFIX}RV='${${GD_PREFIX}RV}'")
+ endif()
+
+ if(${GD_PREFIX}VERBOSE)
+ message(STATUS "</GET_DATE>")
+ message(STATUS "")
+ endif()
+endmacro()
+
+macro(ADD_SECONDS sec)
set(new_min ${${GD_PREFIX}MINUTE})
set(new_hr ${${GD_PREFIX}HOUR})
math(EXPR new_sec "${sec} + ${${GD_PREFIX}SECOND}")
@@ -230,4 +230,4 @@ MACRO(ADD_SECONDS sec)
if(${hr_len} EQUAL 1)
set(new_hr "0${new_hr}")
endif()
-ENDMACRO(ADD_SECONDS)
+endmacro()