1 2 MACRO(TIMESTAMP RESULT) 3 IF(WIN32) 4 EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE DATE) 5 string(REGEX REPLACE "(..)[/.](..)[/.](....).*" "\\3\\2\\1" DATE ${DATE}) 6 EXECUTE_PROCESS(COMMAND "cmd" " /C time /T" OUTPUT_VARIABLE TIME) 7 string(REGEX REPLACE "(..):(..)" "\\1\\2" TIME ${TIME}) 8 set (${RESULT} "${DATE}${TIME}") 9 ELSEIF(UNIX) 10 EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d%H%M" OUTPUT_VARIABLE ${RESULT}) 11 ELSE() 12 MESSAGE(SEND_ERROR "date not implemented") 13 SET(${RESULT} 000000000000) 14 ENDIF() 15 ENDMACRO() 16