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

# set CMake module path to include version macros
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
                      ${VERSION_MODULE_PATH})

# include version macros
include(Version)

# get Git version of Git repository
get_repository_version(XLOOP_VERSION ${VERSION_INPUT_FILE} ${VERSION_BUILD_TYPE})

# generate version header if header does not exists
if(NOT EXISTS ${VERSION_INPUT_FILE})
    # write dnbd3 version into a new C source file based on the specified version template
    configure_file(${VERSION_INPUT_FILE_TEMPLATE} ${VERSION_OUTPUT_FILE})
endif(NOT EXISTS ${VERSION_INPUT_FILE})