r282003 - [CMake] Support overriding CLANG_VERSION_*

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 20 12:09:21 PDT 2016


Author: cbieneman
Date: Tue Sep 20 14:09:21 2016
New Revision: 282003

URL: http://llvm.org/viewvc/llvm-project?rev=282003&view=rev
Log:
[CMake] Support overriding CLANG_VERSION_*

As with how we handle LLVM_VERSION_* variables we should support
overriding clang version variables.

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=282003&r1=282002&r2=282003&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Tue Sep 20 14:09:21 2016
@@ -261,10 +261,16 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_
   endif()
 endif()
 
-# Compute the Clang version from the LLVM version.
-set(CLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
-set(CLANG_VERSION_MINOR ${LLVM_VERSION_MINOR})
-set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
+# If CLANG_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
+if(NOT DEFINED CLANG_VERSION_MAJOR)
+  set(CLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+endif()
+if(NOT DEFINED CLANG_VERSION_MINOR)
+  set(CLANG_VERSION_MINOR ${LLVM_VERSION_MINOR})
+endif()
+if(NOT DEFINED CLANG_VERSION_PATCHLEVEL)
+  set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
+endif()
 # Unlike PACKAGE_VERSION, CLANG_VERSION does not include LLVM_VERSION_SUFFIX.
 set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}")
 message(STATUS "Clang version: ${CLANG_VERSION}")




More information about the cfe-commits mailing list