summaryrefslogtreecommitdiff
path: root/cmake/version.cmake
blob: 4f9c6d017353d579baee999cd19ef50a2cf9be1a (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
33
34
35
36
37
38
FIND_PROGRAM(GIT_EXECUTABLE git DOC "git command line client")

get_filename_component(SOURCE_DIR ${SRC} PATH)

EXECUTE_PROCESS(
     COMMAND ${GIT_EXECUTABLE} svn info
     COMMAND grep "Revision"
     WORKING_DIRECTORY "${SOURCE_DIR}"
     OUTPUT_VARIABLE VERSION
     OUTPUT_STRIP_TRAILING_WHITESPACE
)

set( ${NAME} "unknown" )

if (NOT VERSION)
   FIND_PACKAGE(Subversion)

   if (Subversion_FOUND)

   EXECUTE_PROCESS(
      COMMAND svnversion
      WORKING_DIRECTORY "${SOURCE_DIR}"
      OUTPUT_VARIABLE VERSION
      OUTPUT_STRIP_TRAILING_WHITESPACE
   )
   endif(Subversion_FOUND)

   if (VERSION)
      set( ${NAME} ${VERSION} )
   endif(VERSION)
else()
   string(REGEX REPLACE "Revision: " "" ${NAME} ${VERSION})
endif(NOT VERSION)

set(NAVIT_VARIANT "-")

message (STATUS "SVN-version ${${NAME}}")
CONFIGURE_FILE(${SRC} ${DST} @ONLY)