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}")