From: Chris Bieneman Date: Thu, 14 Jan 2016 22:45:12 +0000 (+0000) Subject: [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60de8e5135fb996207e8a53f09364b2c466bb468;p=clang [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On This matches autoconf's ability to put clang revisions in the clang --version spew. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257827 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ad2ac42c40..d8e98c43e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) 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.")