|
|
@ -24,17 +24,21 @@ ELSE()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
MACRO(NOW RESULT)
|
|
|
|
MACRO(NOW RESULT)
|
|
|
|
IF (WIN32)
|
|
|
|
IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
|
|
|
|
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
|
|
|
|
STRING(TIMESTAMP ${RESULT} "%Y-%m-%d %H:%M:%S")
|
|
|
|
IF(NOT DATETIME MATCHES "ERROR")
|
|
|
|
|
|
|
|
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ELSEIF(UNIX)
|
|
|
|
|
|
|
|
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
|
|
|
|
|
|
|
|
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
ELSE()
|
|
|
|
MESSAGE(SEND_ERROR "date not implemented")
|
|
|
|
IF(WIN32)
|
|
|
|
SET(${RESULT} "0000-00-00 00:00:00")
|
|
|
|
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
|
|
|
|
|
|
|
|
IF(NOT DATETIME MATCHES "ERROR")
|
|
|
|
|
|
|
|
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ELSEIF(UNIX)
|
|
|
|
|
|
|
|
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
|
|
|
|
|
|
|
|
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
|
|
|
|
MESSAGE(SEND_ERROR "date not implemented")
|
|
|
|
|
|
|
|
SET(${RESULT} "0000-00-00 00:00:00")
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDMACRO()
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
|
|
|
|