diff options
Diffstat (limited to 'clang-plugin/CMakeLists.txt')
-rw-r--r-- | clang-plugin/CMakeLists.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang-plugin/CMakeLists.txt b/clang-plugin/CMakeLists.txt new file mode 100644 index 000000000..02ffdc173 --- /dev/null +++ b/clang-plugin/CMakeLists.txt @@ -0,0 +1,20 @@ +IF (ENABLE_CLANG_PLUGIN MATCHES "ON") + # Clang plugin for static analysis + if (NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + MESSAGE(FATAL_ERROR "Cannot build clang plugin when compiler is not clang") + endif () + + SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}") + ENABLE_LANGUAGE(CXX) + FIND_PACKAGE(LLVM REQUIRED) + + SET(CLANGPLUGINSRC plugin.cc) + + ADD_LIBRARY(rspamd-clang SHARED ${CLANGPLUGINSRC}) + SET_TARGET_PROPERTIES(rspamd-clang PROPERTIES + COMPILE_FLAGS "${LLVM_CXX_FLAGS} ${LLVM_CPP_FLAGS} ${LLVM_C_FLAGS}" + INCLUDE_DIRECTORIES ${LIBCLANG_INCLUDE_DIR} + LINKER_LANGUAGE CXX) + TARGET_LINK_LIBRARIES(rspamd-clang ${LIBCLANG_LIBRARIES}) + LINK_DIRECTORIES(${LLVM_LIBRARY_DIRS}) +ENDIF() |