summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@freebsd.org>2013-05-29 21:09:18 +0000
committerRoman Divacky <rdivacky@freebsd.org>2013-05-29 21:09:18 +0000
commitff62d64c63cbae47ed768638aa9c621eccff030c (patch)
tree9484dc9528d18d66c81276bbcce3233b7c074e82
parent1acb394679b6e644044a0f6c358229759009b1a6 (diff)
downloadclang-ff62d64c63cbae47ed768638aa9c621eccff030c.tar.gz
clang-ff62d64c63cbae47ed768638aa9c621eccff030c.tar.bz2
clang-ff62d64c63cbae47ed768638aa9c621eccff030c.tar.xz
Turn CLANG_ENABLE_{ARCMT,REWRITER,STATIC_ANALYZER} into proper options so that
users can disable those. Just like in autoconf generated makefiles. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182881 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt23
-rw-r--r--lib/CMakeLists.txt8
-rw-r--r--tools/driver/CMakeLists.txt27
-rw-r--r--unittests/CMakeLists.txt14
4 files changed, 57 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d05a4cdb5..faecb0da07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,8 +264,27 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
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
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 053320ced1..a0645ca26f 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -3,7 +3,9 @@ add_subdirectory(Basic)
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)
@@ -15,5 +17,7 @@ add_subdirectory(Serialization)
add_subdirectory(Frontend)
add_subdirectory(FrontendTool)
add_subdirectory(Tooling)
-add_subdirectory(StaticAnalyzer)
+if(CLANG_ENABLE_STATIC_ANALYZER)
+ add_subdirectory(StaticAnalyzer)
+endif()
add_subdirectory(Format)
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 97ac7a46c1..3dac964f80 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -29,16 +29,31 @@ target_link_libraries(clang
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)
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
index 334ea41422..fed775ef02 100644
--- a/unittests/CMakeLists.txt
+++ b/unittests/CMakeLists.txt
@@ -9,10 +9,14 @@ function(add_clang_unittest test_dirname)
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()