File: GenerateVersionHeader.cmake

package info (click to toggle)
gnudatalanguage 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,832 kB
  • sloc: cpp: 198,435; ansic: 47,740; sh: 691; python: 474; makefile: 149; xml: 69; f90: 28
file content (16 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# based on https://github.com/nocnokneo/cmake-git-versioning-example/blob/master/CMakeLists.txt

execute_process(
  COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --always --match "v*" 
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  OUTPUT_VARIABLE VERSION
  RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
  OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT "${GIT_DESCRIBE_ERROR_CODE}" EQUAL "0") 
  message(FATAL_ERROR
    "Failed to obtain version data from git. "
    "Please use GDL tarballs which contain version.h header (release or weekly from https://github.com/gnudatalanguage/gdl/releases). "
    "Alternatively, clone the repo using git to be able to generate version.h from git metadata")
endif()
configure_file(${SRC} ${DST})