Last active
June 30, 2017 18:06
-
-
Save willkill07/6c9ee4db5ff4a702bb4c3ba0af9b908e to your computer and use it in GitHub Desktop.
Clang Plugin CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find_package(Clang REQUIRED) | |
set(CLANG_LIBRARIES clangAST clangASTMatchers clangAnalysis clangBasic clangDriver clangEdit clangFrontend clangFrontendTool clangLex clangParse clangSema clangEdit clangRewrite clangRewriteFrontend clangStaticAnalyzerFrontend clangStaticAnalyzerCheckers clangStaticAnalyzerCore clangSerialization clangToolingCore clangTooling clangFormat) | |
macro(add_clang_plugin _name) | |
add_library(${_name} SHARED "") | |
set_target_properties(${_name} | |
PROPERTIES | |
CXX_STANDARD 11 | |
CXX_STANDARD_REQUIRED On | |
CXX_EXTENSIONS Off) | |
target_include_directories(${_name} | |
PRIVATE | |
${LLVM_INCLUDE_DIR}) | |
target_link_libraries(${_name} | |
libclang) | |
endmacro(add_clang_plugin) | |
macro(add_clang_executable _name) | |
add_executable(${_name} "") | |
set_target_properties(${_name} | |
PROPERTIES | |
CXX_STANDARD 11 | |
CXX_STANDARD_REQUIRED On | |
CXX_EXTENSIONS Off) | |
target_include_directories(${_name} | |
PRIVATE | |
${LLVM_INCLUDE_DIR}) | |
target_link_libraries(${_name} | |
${CLANG_LIBRARIES} ${LLVM_AVAILABLE_LIBS}) | |
endmacro(add_clang_executable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.6) | |
project(ClangPluginExamples CXX) | |
include(cmake/AddClangPlugin.cmake) | |
add_subdirectory(src_clang) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_clang_plugin(plugin_print_funcnames) | |
target_sources(plugin_print_funcnames | |
PUBLIC | |
plugin_print_funcnames.cpp) | |
add_clang_executable(tooling_sample) | |
target_sources(tooling_sample | |
PUBLIC | |
tooling_sample.cpp) | |
target_link_libraries(tooling_sample | |
clangTooling) | |
add_clang_executable(rewritersample) | |
target_sources(rewritersample | |
PUBLIC | |
rewritersample.cpp) | |
add_clang_executable(clang_check) | |
target_sources(clang_check | |
PUBLIC | |
ClangCheck.cpp) | |
target_link_libraries(clang_check | |
clangTooling) | |
add_clang_executable(matchers_rewriter) | |
target_sources(matchers_rewriter | |
PUBLIC | |
matchers_rewriter.cpp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment