mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-04-19 19:30:50 +02:00
cmake fix: generate build timestamp
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41029 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
692baa9d6a
commit
e41d163083
2 changed files with 18 additions and 5 deletions
|
|
@ -13,11 +13,6 @@ set (DBUS_VERSION ${DBUS_MAJOR_VERSION}.${DBUS_MINOR_VERSION}.${DBUS_MICRO_VERSI
|
|||
|
||||
set (DBUS_VERSION_STRING "${DBUS_VERSION}")
|
||||
|
||||
if (NOT DBUS_BUILD_TIMESTAMP)
|
||||
message(STATUS "FIXME set DBUS_BUILD_TIMESTAMP to current date or fix current time stamp generation for having actual build date in version file info")
|
||||
set (DBUS_BUILD_TIMESTAMP 20091231)
|
||||
endif (NOT DBUS_BUILD_TIMESTAMP)
|
||||
|
||||
# we need to be up to date
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
|
||||
if(COMMAND cmake_policy)
|
||||
|
|
@ -27,6 +22,9 @@ endif(COMMAND cmake_policy)
|
|||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
|
||||
|
||||
include(Macros)
|
||||
TIMESTAMP(DBUS_BUILD_TIMESTAMP)
|
||||
|
||||
########### basic vars ###############
|
||||
|
||||
|
||||
|
|
|
|||
15
cmake/modules/Macros.cmake
Normal file
15
cmake/modules/Macros.cmake
Normal file
|
|
@ -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()
|
||||
Loading…
Add table
Reference in a new issue