1 include(GitInformation)
4 git_check_repository(GIT_REPO_FOUND)
6 git_commit_hash(GIT_COMMIT_HASH GIT_COMMIT_HASH_SHORT)
7 git_branch_name(GIT_BRANCH)
8 message(STATUS "git branch: ${GIT_BRANCH}")
9 message(STATUS "git commit hash: ${GIT_COMMIT_HASH}")
11 # version handling if repository information is available
12 git_head_tag(GIT_HEAD_TAG)
13 message(STATUS "git head tag: ${GIT_HEAD_TAG}")
14 if("${GIT_HEAD_TAG}" STREQUAL "")
15 set(PROJECT_VERSION "${PROJECT_VERSION}-${GIT_COMMIT_HASH_SHORT}")
16 elseif(NOT ("${GIT_HEAD_TAG}" MATCHES "[v]?[0-9]+\..*"))
17 set(PROJECT_VERSION "${PROJECT_VERSION}-${GIT_HEAD_TAG}")
20 message(STATUS "no git repository found, no further version info available")
23 message(STATUS "git not found, no further version info available")
25 message(STATUS "Project Version: ${PROJECT_VERSION}")