From c755a885bf720ca7ddd6e0faa96a8cc6ed9d7d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manu=20S=C3=A1nchez?= Date: Fri, 10 Aug 2018 16:33:12 +0200 Subject: [PATCH] Ignore git tags in llvm-config version numbers (#65) Some llvm precompiled releases, such as 5.0.0 have a git tag as part of the version number given by their llvm-config, but the rest of the setup (for example, the system includes directory) uses the semantic versioning tag ("5.0.0") only. This commit adds a regex filter to ignore any tag appended to the llvm version number, if any. --- external/external.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/external.cmake b/external/external.cmake index 6f375ef..3b98296 100644 --- a/external/external.cmake +++ b/external/external.cmake @@ -122,6 +122,10 @@ function(_cppast_find_libclang config_tool min_version force) # check version execute_process(COMMAND ${LLVM_CONFIG_BINARY} --version OUTPUT_VARIABLE llvm_version OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Ignore git tags in the version string, get the semver number only + string(REGEX REPLACE "([0-9]).([0-9]).([0-9])(.*)" "\\1.\\2.\\3" llvm_version "${llvm_version}") + if(llvm_version VERSION_LESS min_version) message(FATAL_ERROR "Outdated LLVM version ${llvm_version}, minimal supported is ${min_version}") else()