summaryrefslogtreecommitdiff
path: root/cmake/modules/generate_version_file.cmake
blob: cdbce4217b5b64f62c0863431b847c2beb8a48ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
execute_process(
	COMMAND git rev-parse --short HEAD
	RESULT_VARIABLE PARSE_RESULT
	OUTPUT_VARIABLE PARSE_OUTPUT
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
	COMMAND git status --porcelain
	OUTPUT_VARIABLE STATUS_OUTPUT
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PARSE_RESULT)
	set(VERSION "${PARSE_OUTPUT}")
	if(NOT ${STATUS_OUTPUT})
		set(VERSION "${VERSION}*")
	endif()
else()
	set(VERSION "NOTFOUND")
endif()
configure_file("${TEMPLATE}" "${OUTPUT}" @ONLY)