[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35135] trunk/blender/build_files/cmake/ buildinfo.cmake: Make buildinfo not fail with git-svn as suggested by Nicholas Bishop.
gsr b3d
gsr.b3d at infernal-iceberg.com
Fri Feb 25 05:02:59 CET 2011
Revision: 35135
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35135
Author: gsrb3d
Date: 2011-02-25 04:02:58 +0000 (Fri, 25 Feb 2011)
Log Message:
-----------
Make buildinfo not fail with git-svn as suggested by Nicholas Bishop.
Improve formating and comments a bit.
Modified Paths:
--------------
trunk/blender/build_files/cmake/buildinfo.cmake
Modified: trunk/blender/build_files/cmake/buildinfo.cmake
===================================================================
--- trunk/blender/build_files/cmake/buildinfo.cmake 2011-02-25 02:38:19 UTC (rev 35134)
+++ trunk/blender/build_files/cmake/buildinfo.cmake 2011-02-25 04:02:58 UTC (rev 35135)
@@ -1,17 +1,21 @@
-# this is called by cmake as an extermal process from
+# This is called by cmake as an extermal process from
# ./source/creator/CMakeLists.txt to write ./source/creator/buildinfo.h
-# the FindSubversion.cmake module is part of the standard distribution
+# The FindSubversion.cmake module is part of the standard distribution
include(FindSubversion)
-# extract working copy information for SOURCE_DIR into MY_XXX variables
-if(Subversion_FOUND)
- Subversion_WC_INFO(${SOURCE_DIR} MY)
-else()
- set(MY_WC_REVISION "unknown")
+
+# Extract working copy information for SOURCE_DIR into MY_XXX variables
+# with a default in case anything fails, for examble when using git-svn
+set(MY_WC_REVISION "unknown")
+# Guess if this is a SVN working copy and then look up the revision
+if(EXISTS ${CMAKE_SOURCE_DIR}/.svn/)
+ if(Subversion_FOUND)
+ bversion_WC_INFO(${SOURCE_DIR} MY)
+ endif()
endif()
# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
-# But BUILD_DATE is plataform dependant
+# but BUILD_DATE and BUILD_TIME are plataform dependant
if(UNIX)
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -21,14 +25,14 @@
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
-# write a file with the SVNVERSION define
+# Write a file with the SVNVERSION define
file(WRITE buildinfo.h.txt
"#define BUILD_REV ${MY_WC_REVISION}\n"
"#define BUILD_DATE ${BUILD_DATE}\n"
"#define BUILD_TIME ${BUILD_TIME}\n"
)
-# copy the file to the final header only if the version changes
-# reduces needless rebuilds
+# Copy the file to the final header only if the version changes
+# and avoid needless rebuilds
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
buildinfo.h.txt buildinfo.h)
More information about the Bf-blender-cvs
mailing list