forked from abreheret/PixelAnnotationTool
-
Notifications
You must be signed in to change notification settings - Fork 1
/
git_version.cmake.in
35 lines (31 loc) · 875 Bytes
/
git_version.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cmake_minimum_required(VERSION 2.8)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@"
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git log -1 --format=%ai
WORKING_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@"
OUTPUT_VARIABLE GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git describe
WORKING_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@"
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(ARCH_TYPE "@ARCH_TYPE@")
message(STATUS "update git version")
configure_file(
@CMAKE_CURRENT_SOURCE_DIR@/pixel_annotation_tool_version.h.in
@CMAKE_BINARY_DIR@/pixel_annotation_tool_version.h
)