Oscar Fuentes | ee99317 | 2010-08-03 17:28:09 +0000 | [diff] [blame^] | 1 | # 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 | |
| 5 | function(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) |
| 20 | endfunction(add_version_info_from_vcs) |