Skip to content

Commit

Permalink
cmake: llvm: set minor version to zero
Browse files Browse the repository at this point in the history
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, ...
  • Loading branch information
jcelerier authored and sletz committed Feb 27, 2021
1 parent ad377a2 commit 5fbe042
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion build/CMakeLists.txt
Expand Up @@ -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)
Expand Down

0 comments on commit 5fbe042

Please sign in to comment.