diff options
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/Macros.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/modules/Macros.cmake b/cmake/modules/Macros.cmake new file mode 100644 index 00000000..b6371568 --- /dev/null +++ b/cmake/modules/Macros.cmake @@ -0,0 +1,15 @@ + +MACRO(TIMESTAMP RESULT) + IF(WIN32) + EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE DATE) + string(REGEX REPLACE "(..)[/.](..)[/.](....).*" "\\3\\2\\1" DATE ${DATE}) + EXECUTE_PROCESS(COMMAND "cmd" " /C time /T" OUTPUT_VARIABLE TIME) + string(REGEX REPLACE "(..):(..)" "\\1\\2" TIME ${TIME}) + set (${RESULT} "${DATE}${TIME}") + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d%H%M" OUTPUT_VARIABLE ${RESULT}) + ELSE() + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} 000000000000) + ENDIF() +ENDMACRO() |