[cfe-commits] [PATCH][CMake] Fix SVN_REVISION for Basic/Version.cpp using git-svn.
nobled
nobled at dreamwidth.org
Wed Feb 15 00:47:20 PST 2012
On Mon, Feb 13, 2012 at 11:11 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> This patch correctly defines SVN_REVISION in Basic/Version.cpp for git
> for both in tree and out of tree clang when using CMake.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2087c6a..477403c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,12 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
include(HandleLLVMOptions)
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
+ include(VersionFromVCS)
+ option(CLANG_APPEND_VC_REV
+ "Append the version control system revision id to CLANG version" OFF)
+ if( CLANG_APPEND_VC_REV )
+ add_version_info_from_vcs(PACKAGE_VERSION)
+ endif()
Won't this create a confusing pileup of revision suffixes when both
LLVM_APPEND_VC_REV and CLANG_APPEND_VC_REV are on? Something like:
3.1git-svn-r150477-e800a7dgit-svn-r150560-37ce010
And you can't tell which is clang's and which is LLVM's.
Maybe instead, initialize PACKAGE_VERSION with these new variables
before appending:
set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn")
set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt
index ef2e93c..6856122 100644
--- a/lib/Basic/CMakeLists.txt
+++ b/lib/Basic/CMakeLists.txt
@@ -22,14 +22,8 @@ add_clang_library(clangBasic
# Determine Subversion revision.
# FIXME: This only gets updated when CMake is run, so this revision number
# may be out-of-date!
-if( NOT IS_SYMLINK "${CLANG_SOURCE_DIR}" ) # See PR 8437
- find_package(Subversion)
-endif()
-if (Subversion_FOUND AND EXISTS "${CLANG_SOURCE_DIR}/.svn")
- Subversion_WC_INFO(${CLANG_SOURCE_DIR} CLANG)
- set_source_files_properties(Version.cpp
- PROPERTIES COMPILE_DEFINITIONS "SVN_REVISION=\"${CLANG_WC_REVISION}\"")
-endif()
+set_source_files_properties(Version.cpp
+ PROPERTIES COMPILE_DEFINITIONS "SVN_REVISION=\"${SVN_REVISION}\"")
add_dependencies(clangBasic
ClangARMNeon
>
> - Michael Spencer
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list