aboutsummaryrefslogtreecommitdiffstats
path: root/clang-plugin/CMakeLists.txt
diff options
context:
space:
mode:
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)