summaryrefslogtreecommitdiffstats
path: root/modules/TDEVersion.cmake
blob: 13d01e851a0c06396a1ebf2606316fc4e1a12b1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#################################################
#
#  (C) 2022 Michele Calgaro
#  michele (DOT) calgaro (AT) yahoo (DOT) it
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

#################################################
#####
##### tde_set_project_version

macro( tde_set_project_version )

  set( DEFAULT_VERSION "R14.1.1~[DEVELOPMENT]" )

  unset( VERSION )

  if( EXISTS ${CMAKE_SOURCE_DIR}/.tdescminfo )
    file( STRINGS ${CMAKE_SOURCE_DIR}/.tdescminfo VERSION_STRING REGEX "^Version:.+$" )
    string( REGEX REPLACE "^Version: (R[0-9]+\.[0-9]+\.[0-9]+.*)$" "\\1" VERSION "${VERSION_STRING}" )
  endif()

  if( NOT VERSION )
    set( VERSION "${DEFAULT_VERSION}" )
  endif()

endmacro( )