I've seen people are specifying the version as git-master but this is a moving target - a week from now it could be several commits away. It should really only be used to specify that it is master branch. The commit hash or number of commits from a tag should also be included (
git describe does both). This is contradictory to what is being used for version in the crash logs (other places too?). Perhaps there is a way to create a file that is updated each build like
here. It would also solve the issue with build date in the crash logs (it only updates if the file with the preprossor string is explicitly told to compile).
Edit:
This could be used in CMake to add a custom build rule.
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_commandadd_custom_command(TARGET target
PRE_BUILD | PRE_LINK | POST_BUILD
COMMAND command1 [ARGS] [args1...]
[COMMAND command2 [ARGS] [args2...] ...]
[WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM])
Something like this for source/game/CMakeLists.txt:
if(WIN32)
add_custom_command(TARGET glestadv PRE_LINK COMMAND version.bat)
else(WIN32)
add_custom_command(TARGET glestadv PRE_LINK COMMAND version.sh)
endif(WIN32)
Edit2:
I've committed something that might work (it does for me anyway with VS).