summaryrefslogtreecommitdiffstats
path: root/cmake/GenerateVersion.cmake
blob: e336489f53dae301abfdab96607307849c8c05ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2020 Manuel Bentele <development@manuel-bentele.de>
#

# get Git short hash and tag of latest repository commit
execute_process(COMMAND git describe HEAD
                OUTPUT_VARIABLE DNBD3_VERSION
                OUTPUT_STRIP_TRAILING_WHITESPACE)
if(DNBD3_VERSION STREQUAL "")
    set(DNBD3_VERSION "unknown")
endif(DNBD3_VERSION STREQUAL "")

# write dnbd3 version into a new C source file based on the specified version template
configure_file(${VERSION_INPUT_FILE} ${VERSION_OUTPUT_FILE})