summaryrefslogtreecommitdiff
path: root/cmake/modules
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2011-09-20 09:57:52 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2011-09-22 19:55:13 +0200
commite41d1630839cf08c9f13dec72bf395f2773eb680 (patch)
tree873317a0daae4156a1c2d3c4095c7d12568c1ee9 /cmake/modules
parent692baa9d6a990523f4d4e7f3297f0d012332035f (diff)
downloaddbus-e41d1630839cf08c9f13dec72bf395f2773eb680.tar.gz
cmake fix: generate build timestamp
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41029 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/Macros.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/modules/Macros.cmake b/cmake/modules/Macros.cmake
new file mode 100644
index 00000000..b6371568
--- /dev/null
+++ b/cmake/modules/Macros.cmake
@@ -0,0 +1,15 @@
+
+MACRO(TIMESTAMP RESULT)
+ IF(WIN32)
+ EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE DATE)
+ string(REGEX REPLACE "(..)[/.](..)[/.](....).*" "\\3\\2\\1" DATE ${DATE})
+ EXECUTE_PROCESS(COMMAND "cmd" " /C time /T" OUTPUT_VARIABLE TIME)
+ string(REGEX REPLACE "(..):(..)" "\\1\\2" TIME ${TIME})
+ set (${RESULT} "${DATE}${TIME}")
+ ELSEIF(UNIX)
+ EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d%H%M" OUTPUT_VARIABLE ${RESULT})
+ ELSE()
+ MESSAGE(SEND_ERROR "date not implemented")
+ SET(${RESULT} 000000000000)
+ ENDIF()
+ENDMACRO()