summaryrefslogtreecommitdiff
path: root/cmake/modules/generate_version_file.cmake
blob: bbe34c69fee9306d32a6a49aaec1a742d6cd848d (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(HASH "${PARSE_OUTPUT}")
	if(NOT ${STATUS_OUTPUT})
		set(HASH "${HASH}*")
	endif()
else()
	set(HASH "NOTFOUND")
endif()
configure_file("${TEMPLATE}" "${OUTPUT}" @ONLY)