~ubuntu-branches/ubuntu/feisty/clamav/feisty

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/cmake/modules/VersionFromVCS.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-02-20 10:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20070220103344-zgcu2psnx9d98fpa
Tags: upstream-0.90
ImportĀ upstreamĀ versionĀ 0.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
    # Try to get a ref-id
19
 
    find_program(git_executable NAMES git git.exe git.cmd)
20
 
    if( git_executable )
21
 
      execute_process(COMMAND ${git_executable} show-ref HEAD
22
 
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
23
 
        TIMEOUT 5
24
 
        RESULT_VARIABLE git_result
25
 
        OUTPUT_VARIABLE git_output)
26
 
      if( git_result EQUAL 0 )
27
 
        string(SUBSTRING ${git_output} 0 7 git_ref_id)
28
 
        set(result "${result}-${git_ref_id}")
29
 
      endif()
30
 
    endif()
31
 
  endif()
32
 
  set(${VERS} ${result} PARENT_SCOPE)
33
 
endfunction(add_version_info_from_vcs)