aboutsummaryrefslogtreecommitdiffstats
path: root/clang-plugin/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-09 18:51:25 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-09 18:51:25 +0000
commit5570704c53a565e9eb70e362ee341d6aacf8b823 (patch)
treeabe233dc7aed3f7b66267bac172c15b0b43aea71 /clang-plugin/CMakeLists.txt
parent7d7d5953c9b9a64acd6bf3bc5995992761a52deb (diff)
downloadrspamd-5570704c53a565e9eb70e362ee341d6aacf8b823.tar.gz
rspamd-5570704c53a565e9eb70e362ee341d6aacf8b823.zip
Start implemetation of static analysis plugin
Diffstat (limited to 'clang-plugin/CMakeLists.txt')
-rw-r--r--clang-plugin/CMakeLists.txt20
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()