Mhmm, doesn't really work for me. game_incs holds a list of folders where headers are located, not header files. The shell script creates version.c instead of version.cpp.
Anyway we already set the version in cmake through projectConfig.h, so maybe it's better to do it in cmake. Something like this:
# only run this when we build from git, not tarball, and we haven't set GAE_VERSION explicitly
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GAE_VERSION STREQUAL "git-master")
find_package(Git REQUIRED)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE GAE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("GAE_VERSION is ${GAE_VERSION}")
endif()
The git-master comparison is probably a bit silly and looks strange but it should work because the new GAE_VERSION from git describe isn't written to the cmake cache. That's why another run of cmake reads the old value from the cache and we can change it again.