Fix annoying space and newline in date constant on windows requiring manual fix each time

This commit is contained in:
Andre Bernet
2016-02-09 01:22:23 +04:00
parent 11cc82a7ac
commit c7bd968586
+1
View File
@@ -2,6 +2,7 @@ macro(today RESULT)
if(WIN32)
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\1.\\2.\\3" ${RESULT} ${${RESULT}})
string(SUBSTRING ${${RESULT}} 0 10 ${RESULT})
elseif(UNIX)
execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(....)-(..)-(..).*" "\\1-\\2-\\3" ${RESULT} ${${RESULT}})