From 5fbe04232cfcf28b3aa6e64a6dd4d9347f3735a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Wed, 27 Jan 2021 21:40:12 +0100 Subject: [PATCH] cmake: llvm: set minor version to zero Nowadays LLVM minor version is closer to the "patch" version of the 3.x era, and won't break API. Thus set it at zero in the LLVM_xxx define so that we don't have to add ifdefs for LLVM_111, LLVM_112, ... --- build/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 93c34b5424..e2a5c063f1 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -84,7 +84,13 @@ if (INCLUDE_LLVM ) llvm_cmake() endif() - string (REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "LLVM_\\1\\2" LLVM_VERSION ${LLVM_PACKAGE_VERSION}) + string (REGEX REPLACE "([0-9]+)\\.[0-9]+.*" "\\1" LLVM_MAJOR_VERSION ${LLVM_PACKAGE_VERSION}) + string (REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" LLVM_MINOR_VERSION ${LLVM_PACKAGE_VERSION}) + if(LLVM_MAJOR_VERSION GREATER 9) + set(LLVM_VERSION "LLVM_${LLVM_MAJOR_VERSION}0") + else() + set(LLVM_VERSION "LLVM_${LLVM_MAJOR_VERSION}${LLVM_MINOR_VERSION}") + endif() # the declarations below are redundant but necessary to cope with different cmake behaviors on different platforms set (TMP ${SRCDIR}/generator/llvm)