Commit: ea6c9f17bd4929f55632345a8c2173c59b78b22b
Author: Bernhard M. Wiedemann
Date:   Wed Sep 18 20:35:16 2019 +0200
Branches: master
https://developer.blender.org/rBea6c9f17bd4929f55632345a8c2173c59b78b22b

Use cmake TIMESTAMP for BUILD_DATE+TIME

Use cmake TIMESTAMP for BUILD_DATE+TIME
this simplifies code a lot
and even makes it more portable to other platforms

TIMESTAMP is available since cmake-2.8.11 ; blender already requires
cmake>=3.5 so that is fine.

Note that with CMake>=3.8, if defined, the SOURCE_DATE_EPOCH envvar
will be used by CMake here.

Reviewers: mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Differential Revision: https://developer.blender.org/D5760

===================================================================

M       build_files/cmake/buildinfo.cmake

===================================================================

diff --git a/build_files/cmake/buildinfo.cmake 
b/build_files/cmake/buildinfo.cmake
index ec43534528a..cef6b94ee2e 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -145,22 +145,13 @@ if(EXISTS ${SOURCE_DIR}/.git)
   unset(_git_changed_files)
 endif()
 
-# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
+# BUILD_PLATFORM is taken from CMake
 # but BUILD_DATE and BUILD_TIME are platform dependent
-if(UNIX)
-  if(NOT BUILD_DATE)
-    execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE 
OUTPUT_STRIP_TRAILING_WHITESPACE)
-  endif()
-  if(NOT BUILD_TIME)
-    execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME 
OUTPUT_STRIP_TRAILING_WHITESPACE)
-  endif()
-elseif(WIN32)
-  if(NOT BUILD_DATE)
-    execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE BUILD_DATE 
OUTPUT_STRIP_TRAILING_WHITESPACE)
-  endif()
-  if(NOT BUILD_TIME)
-    execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME 
OUTPUT_STRIP_TRAILING_WHITESPACE)
-  endif()
+if(NOT BUILD_DATE)
+  STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
+endif()
+if(NOT BUILD_TIME)
+  STRING(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC)
 endif()
 
 # Write a file with the BUILD_HASH define

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to