WSL/SLF GitLab Repository

Commit 5dd995f2 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

proper retrieval of compilation date and version number that also works on Windows

parent 8e1a9c0f
#building version number in variable _versionString
MACRO (GETDATE TODAY)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${TODAY})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3\\2\\1" ${TODAY} ${${TODAY}})
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${TODAY})
string(REGEX REPLACE "(....)-(..)-(..).*" "\\1\\2\\3" ${TODAY} ${${TODAY}})
ELSE (WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${TODAY} 000000)
ENDIF (WIN32)
IF(CMAKE_VERSION VERSION_GREATER 2.8.11)
STRING(TIMESTAMP TODAY "%Y%m%d")
ELSE(CMAKE_VERSION VERSION_GREATER 2.8.11)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${TODAY})
STRING(REGEX REPLACE "(..)/(..)/(....) .*\n" "\\3\\2\\1" ${TODAY} ${${TODAY}}) #US format
STRING(REGEX REPLACE "(..)-(..)-(....) .*\n" "\\3\\2\\1" ${TODAY} ${${TODAY}}) #UK format
STRING(REGEX REPLACE "(..)\\.(..)\\.(....) .*\n" "\\3\\2\\1" ${TODAY} ${${TODAY}}) #CH format
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${TODAY})
string(REGEX REPLACE "(....)-(..)-(..).*" "\\1\\2\\3" ${TODAY} ${${TODAY}})
ELSE (WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${TODAY} 000000)
ENDIF (WIN32)
ENDIF(CMAKE_VERSION VERSION_GREATER 2.8.11)
ENDMACRO (GETDATE)
MACRO(BuildVersion)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment