blob: 618b232ec2d42ed852a946fb854e27ff3834d6fa [file] [log] [blame]
Oscar Fuentesee993172010-08-03 17:28:09 +00001# Adds version control information to the variable VERS. For
2# determining the Version Control System used (if any) it inspects the
3# existence of certain subdirectories under CMAKE_CURRENT_SOURCE_DIR.
4
5function(add_version_info_from_vcs VERS)
6 set(result ${${VERS}})
7 if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn )
8 set(result "${result}svn")
9 find_package(Subversion)
10 if( Subversion_FOUND )
11 subversion_wc_info( ${CMAKE_CURRENT_SOURCE_DIR} Project )
12 if( Project_WC_REVISION )
13 set(result "${result}-r${Project_WC_REVISION}")
14 endif()
15 endif()
16 elseif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git )
17 set(result "${result}git")
18 endif()
19 set(${VERS} ${result} PARENT_SCOPE)
20endfunction(add_version_info_from_vcs)