3 # You need to pass SRC and BIN for this to work
4 # SRC is the source directory which contains version.h.in
5 # BIN is the binary directory where to write version.h to
7 # thanks to https://cmake.org/pipermail/cmake/2010-July/038015.html
9 find_package(Git QUIET)
14 ${GIT_EXECUTABLE} -C ${SRC} describe --always --dirty --tags
15 RESULT_VARIABLE GIT_RETCODE
16 OUTPUT_VARIABLE GIT_OUTPUT_VERSION
17 ERROR_VARIABLE GIT_RAN_ERROR
18 OUTPUT_STRIP_TRAILING_WHITESPACE
21 message("Git not found, won't be able to autogenerate version")
24 # exit status 0 means successful
25 if(NOT Git_FOUND OR GIT_RETCODE)
26 set(GIT_RAN_SUCCESSFULLY 0)
28 set(GIT_RAN_SUCCESSFULLY 1)
32 # overwriting version.h in ok (?), I want the generated one to be preferred
33 # and I guess include_directories in only appended...