cmake TIMESTAMP not working with older cmake
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Wed, 9 Sep 2020 19:59:33 +0000 (21:59 +0200)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Wed, 9 Sep 2020 19:59:33 +0000 (21:59 +0200)
CMakeLists.txt

index 0e6f8ca..689bb9c 100644 (file)
@@ -20,9 +20,10 @@ MACRO (TODAY RESULT)
         EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE ${RESULT})
         string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" ${RESULT} ${${RESULT}})
     ELSEIF(UNIX)
-#        EXECUTE_PROCESS(COMMAND "date" OUTPUT_VARIABLE ${RESULT})
-#        string(REGEX REPLACE "(...) (...) (.+) (..:..:..) (.+) (....).*" "\\1 \\2 \\3 \\4 \\5 \\6" ${RESULT} ${${RESULT}})
-        string(TIMESTAMP ${RESULT})
+        EXECUTE_PROCESS(COMMAND "date" "+'%D %R:%S'" OUTPUT_VARIABLE ${RESULT})
+        string(REGEX REPLACE "'" ""  ${RESULT} ${${RESULT}})
+        string (STRIP ${${RESULT}} ${RESULT})
+#        string(TIMESTAMP ${RESULT})
     ELSE (WIN32)
         MESSAGE(SEND_ERROR "date not implemented")
         SET(${RESULT} 000000)