-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathversion.cmake
22 lines (21 loc) · 871 Bytes
/
version.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
set(tasmomanager_version "v1.0.0")
set(tasmomanager_github_sha "$ENV{GITHUB_SHA}")
if (tasmomanager_github_sha)
get_filename_component(tasmomanager_github_ref "$ENV{GITHUB_REF}" NAME)
string(SUBSTRING "${tasmomanager_github_sha}" 0 8 tasmomanager_github_sha)
set(tasmomanager_version "${tasmomanager_version}-g${tasmomanager_github_sha}-${tasmomanager_github_ref}")
else()
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe --tags
RESULT_VARIABLE tasmomanager_git_describe_result
OUTPUT_VARIABLE tasmomanager_git_describe_output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(tasmomanager_git_describe_result EQUAL 0)
set(tasmomanager_version "${tasmomanager_git_describe_output}")
endif()
endif()
endif()