In a Makefile this would be done with something like:
g++ -DGIT_SHA1=\"`git log -1 | head -n 1`\" ...
This is very useful, because the bina
I'd use sth. like this in my CMakeLists.txt:
exec_program( "git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "describe" OUTPUT_VARIABLE VERSION ) string( REGEX MATCH "-g.*$" VERSION_SHA1 ${VERSION} ) string( REGEX REPLACE "[-g]" "" VERSION_SHA1 ${VERSION_SHA1} ) add_definitions( -DGIT_SHA1="${VERSION_SHA1}" )