llvm.org GIT mirror llvm / ee99317
CMake: add version control info to PACKAGE_VERSION, if available. Adds "svn" or "git", depending on the VCS used. If svn, adds the revision number as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110121 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 9 years ago
2 changed file(s) with 31 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
22 project(LLVM)
33 cmake_minimum_required(VERSION 2.8)
44
5 # Add path for custom modules
6 set(CMAKE_MODULE_PATH
7 ${CMAKE_MODULE_PATH}
8 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
9 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
10 )
11
12 set(PACKAGE_VERSION "2.8")
13 include(VersionFromVCS)
14 add_version_info_from_vcs(PACKAGE_VERSION)
15
516 set(PACKAGE_NAME llvm)
6 set(PACKAGE_VERSION 2.8svn)
717 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
818 set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
919
122132 )
123133
124134 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
125
126 # Add path for custom modules
127 set(CMAKE_MODULE_PATH
128 ${CMAKE_MODULE_PATH}
129 "${LLVM_MAIN_SRC_DIR}/cmake"
130 "${LLVM_MAIN_SRC_DIR}/cmake/modules"
131 )
132135
133136 include(AddLLVMDefinitions)
134137
0 # Adds version control information to the variable VERS. For
1 # determining the Version Control System used (if any) it inspects the
2 # existence of certain subdirectories under CMAKE_CURRENT_SOURCE_DIR.
3
4 function(add_version_info_from_vcs VERS)
5 set(result ${${VERS}})
6 if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn )
7 set(result "${result}svn")
8 find_package(Subversion)
9 if( Subversion_FOUND )
10 subversion_wc_info( ${CMAKE_CURRENT_SOURCE_DIR} Project )
11 if( Project_WC_REVISION )
12 set(result "${result}-r${Project_WC_REVISION}")
13 endif()
14 endif()
15 elseif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git )
16 set(result "${result}git")
17 endif()
18 set(${VERS} ${result} PARENT_SCOPE)
19 endfunction(add_version_info_from_vcs)