r257827 - [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 14 14:45:14 PST 2016


Author: cbieneman
Date: Thu Jan 14 16:45:12 2016
New Revision: 257827

URL: http://llvm.org/viewvc/llvm-project?rev=257827&view=rev
Log:
[CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On

This matches autoconf's ability to put clang revisions in the clang --version spew.

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=257827&r1=257826&r2=257827&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Jan 14 16:45:12 2016
@@ -101,6 +101,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)
+  include(VersionFromVCS)
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
@@ -213,6 +214,18 @@ if(CLANG_REPOSITORY_STRING)
   add_definitions(-DCLANG_REPOSITORY_STRING="${CLANG_REPOSITORY_STRING}")
 endif()
 
+option(CLANG_APPEND_VC_REV
+  "Append the version control system revision id to clang version spew" OFF)
+
+if(NOT SVN_REVISION)
+  # This macro will set SVN_REVISION in the parent scope
+  add_version_info_from_vcs(VERSION_VAR)
+endif()
+
+if(SVN_REVISION)
+  add_definitions(-DSVN_REVISION="${SVN_REVISION}")
+endif()
+
 set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
   "Vendor-specific uti.")
 




More information about the cfe-commits mailing list