add_definitions( -D_GNU_SOURCE )
-# FIXME: They should be options.
-add_definitions(-DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER)
+option(CLANG_ENABLE_ARCMT "Enable ARCMT by default." ON)
+option(CLANG_ENABLE_REWRITER "Enable rewriter by default." ON)
+option(CLANG_ENABLE_STATIC_ANALYZER "Enable static analyzer by default." ON)
+
+if (NOT CLANG_ENABLE_REWRITER AND CLANG_ENABLE_ARCMT)
+ message(FATAL_ERROR "Cannot disable rewriter while enabling ARCMT")
+endif()
+
+if (NOT CLANG_ENABLE_REWRITER AND CLANG_ENABLE_STATIC_ANALYZER)
+ message(FATAL_ERROR "Cannot disable rewriter while enabling static analyzer")
+endif()
+
+if(CLANG_ENABLE_ARCMT)
+ add_definitions(-DCLANG_ENABLE_ARCMT)
+endif()
+if(CLANG_ENABLE_REWRITER)
+ add_definitions(-DCLANG_ENABLE_REWRITER)
+endif()
+if(CLANG_ENABLE_STATIC_ANALYZER)
+ add_definitions(-DCLANG_ENABLE_STATIC_ANALYZER)
+endif()
# Clang version information
set(CLANG_EXECUTABLE_VERSION
add_subdirectory(Lex)
add_subdirectory(Parse)
add_subdirectory(AST)
-add_subdirectory(ASTMatchers)
+if(CLANG_ENABLE_REWRITER)
+ add_subdirectory(ASTMatchers)
+endif()
add_subdirectory(Sema)
add_subdirectory(CodeGen)
add_subdirectory(Analysis)
add_subdirectory(Frontend)
add_subdirectory(FrontendTool)
add_subdirectory(Tooling)
-add_subdirectory(StaticAnalyzer)
+if(CLANG_ENABLE_STATIC_ANALYZER)
+ add_subdirectory(StaticAnalyzer)
+endif()
add_subdirectory(Format)
clangLex
clangParse
clangEdit
- clangARCMigrate
- clangRewriteCore
- clangRewriteFrontend
clangSema
clangSerialization
- clangStaticAnalyzerFrontend
- clangStaticAnalyzerCheckers
- clangStaticAnalyzerCore
)
+if(CLANG_ENABLE_STATIC_ANALYZER)
+ target_link_libraries(clang
+ clangStaticAnalyzerFrontend
+ clangStaticAnalyzerCheckers
+ clangStaticAnalyzerCore
+ )
+endif()
+
+if(CLANG_ENABLE_ARCMT)
+ target_link_libraries(clang
+ clangARCMigrate
+ )
+endif()
+
+if(CLANG_ENABLE_REWRITER)
+ target_link_libraries(clang
+ clangRewriteCore
+ clangRewriteFrontend
+ )
+endif()
+
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
set_target_properties(clang PROPERTIES ENABLE_EXPORTS 1)
add_unittest(ClangUnitTests ${test_dirname} ${ARGN})
endfunction()
-add_subdirectory(ASTMatchers)
-add_subdirectory(AST)
add_subdirectory(Basic)
add_subdirectory(Lex)
-add_subdirectory(Frontend)
-add_subdirectory(Tooling)
-add_subdirectory(Format)
+if(CLANG_ENABLE_STATIC_ANALYZER)
+ add_subdirectory(Frontend)
+endif()
+if(CLANG_ENABLE_REWRITER)
+ add_subdirectory(ASTMatchers)
+ add_subdirectory(AST)
+ add_subdirectory(Tooling)
+ add_subdirectory(Format)
+endif()