38be366a67
with current date. Added CMake script to generate a variable containing the current date. Removed last argument (the terminating NULL element) from output.
17 lines
596 B
CMake
17 lines
596 B
CMake
# This script returns the current date in ISO format
|
|
#
|
|
# YYYY-MM-DD
|
|
#
|
|
MACRO (TODAY RESULT)
|
|
IF (WIN32)
|
|
EXECUTE_PROCESS(COMMAND "cmd" " /C date +%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
|
|
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
|
|
ELSEIF(UNIX)
|
|
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
|
|
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
|
|
ELSE (WIN32)
|
|
MESSAGE(SEND_ERROR "date not implemented")
|
|
SET(${RESULT} 000000)
|
|
ENDIF (WIN32)
|
|
ENDMACRO (TODAY)
|