# Git revision checker
SET (GIT_CMD git)
SET (GIT_ARGS rev-parse HEAD)
SET (GIT_REV_CMD git rev-list --count HEAD)
MESSAGE (STATUS "Checking git revision...")
EXECUTE_PROCESS (COMMAND ${GIT_REV_CMD}
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	OUTPUT_VARIABLE GITREVCMD
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
MATH ( EXPR GITREVCMD "${GITREVCMD}")
MESSAGE (STATUS "Git revision ${GITREVCMD}")
MESSAGE (STATUS "Checking git revision hash...")
EXECUTE_PROCESS (COMMAND ${GIT_CMD} ${GIT_ARGS}
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	OUTPUT_VARIABLE GITHASHCMD
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE (STATUS "Git revision hash ${GITHASHCMD}")

CONFIGURE_FILE (
 "${PROJECT_SOURCE_DIR}/common/version/GitRevision.h.in"
 "${PROJECT_SOURCE_DIR}/common/version/GitRevision.h")