aboutsummaryrefslogtreecommitdiffstats
path: root/clang-plugin/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-27 17:41:06 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-27 17:41:06 +0100
commit939cec679d83d4d1133e358d0377c1d57dde1d82 (patch)
treeffacdc5d4f99174a70279de4ae9d203df59f7065 /clang-plugin/CMakeLists.txt
parentd7e3ea948d8d3d9430b6ae321302b53b4c45f04e (diff)
downloadrspamd-939cec679d83d4d1133e358d0377c1d57dde1d82.tar.gz
rspamd-939cec679d83d4d1133e358d0377c1d57dde1d82.zip
[Minor] Fix LLVM detection
Diffstat (limited to 'clang-plugin/CMakeLists.txt')
-rw-r--r--clang-plugin/CMakeLists.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/clang-plugin/CMakeLists.txt b/clang-plugin/CMakeLists.txt
index 8b2def17e..525d3b57a 100644
--- a/clang-plugin/CMakeLists.txt
+++ b/clang-plugin/CMakeLists.txt
@@ -7,6 +7,48 @@ IF (ENABLE_CLANG_PLUGIN MATCHES "ON")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
ENABLE_LANGUAGE(CXX)
FIND_PACKAGE(LLVM REQUIRED)
+ MESSAGE(STATUS "Trying to find libclang for llvm version ${LLVM_PACKAGE_VERSION}")
+ SET(libclang_llvm_header_search_paths
+ # LLVM Debian/Ubuntu nightly packages: http://llvm.org/apt/
+ "/usr/lib/llvm-${LLVM_PACKAGE_VERSION}/include/"
+ # LLVM MacPorts
+ "/opt/local/libexec/llvm-${LLVM_PACKAGE_VERSION}/include"
+ # LLVM Homebrew
+ "/usr/local/Cellar/llvm/${LLVM_PACKAGE_VERSION}/include"
+ # LLVM Homebrew/versions
+ "/usr/local/lib/llvm-${LLVM_PACKAGE_VERSION}/include"
+ # FreeBSD ports versions
+ "/usr/local/llvm${LLVM_PACKAGE_VERSION}/include"
+ "${LLVM_INCLUDE_DIRS}"
+ )
+
+ SET(libclang_llvm_lib_search_paths
+ # LLVM Debian/Ubuntu nightly packages: http://llvm.org/apt/
+ "/usr/lib/llvm-${LLVM_PACKAGE_VERSION}/lib/"
+ # LLVM MacPorts
+ "/opt/local/libexec/llvm-${LLVM_PACKAGE_VERSION}/lib"
+ # LLVM Homebrew
+ "/usr/local/Cellar/llvm/${LLVM_PACKAGE_VERSION}/lib"
+ # LLVM Homebrew/versions
+ "/usr/local/lib/llvm-${LLVM_PACKAGE_VERSION}/lib"
+ # FreeBSD ports versions
+ "/usr/local/llvm${LLVM_PACKAGE_VERSION}/lib"
+ "${LLVM_LIBRARY_DIRS}"
+ )
+
+ find_path(LIBCLANG_INCLUDE_DIR clang-c/Index.h
+ PATHS ${libclang_llvm_header_search_paths}
+ PATH_SUFFIXES LLVM/include #Windows package from http://llvm.org/releases/
+ DOC "The path to the directory that contains clang-c/Index.h")
+ find_library(LIBCLANG_LIBRARY NAMES libclang.imp libclang clang
+ PATHS ${libclang_llvm_lib_search_paths}
+ PATH_SUFFIXES LLVM/lib #Windows package from http://llvm.org/releases/
+ DOC "The file that corresponds to the libclang library.")
+
+ get_filename_component(LIBCLANG_LIBRARY_DIR ${LIBCLANG_LIBRARY} PATH)
+
+ set(LIBCLANG_LIBRARIES ${LIBCLANG_LIBRARY})
+ set(LIBCLANG_INCLUDE_DIRS ${LIBCLANG_INCLUDE_DIR})
SET(CLANGPLUGINSRC plugin.cc printf_check.cc)