summaryrefslogblamecommitdiffstats
path: root/cmake/GenerateVersion.cmake
blob: 8574ba723aeb2663ac47572f2b4d53fbda09f2f1 (plain) (tree)
1
2
3
4
5
6
7
8
9




                                                                   


                                                 
 

                        
 

                                                                                 
 




                                                                                          
# 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(DNBD3_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})