summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/CMakeLists.txt9
-rw-r--r--tools/CMakeLists.txt5
-rw-r--r--tools/libclang/ARCMigrate.cpp10
-rw-r--r--tools/libclang/CMakeLists.txt23
4 files changed, 36 insertions, 11 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index fe80df4564..2052873cb3 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -26,11 +26,18 @@ endif ()
list(APPEND CLANG_TEST_DEPS
clang clang-headers
- c-index-test diagtool arcmt-test c-arcmt-test
+ c-index-test diagtool
clang-check clang-format
clang-tblgen
)
+if (CLANG_ENABLE_ARCMT)
+ list(APPEND CLANG_TEST_DEPS
+ arcmt-test
+ c-arcmt-test
+ )
+endif ()
+
if (ENABLE_CLANG_EXAMPLES)
list(APPEND CLANG_TEST_DEPS
clang-interpreter
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 58be615e85..d3f67a8960 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -5,9 +5,10 @@ if(CLANG_ENABLE_REWRITER)
add_subdirectory(clang-format-vs)
endif()
+add_subdirectory(c-index-test)
+add_subdirectory(libclang)
+
if(CLANG_ENABLE_ARCMT)
- add_subdirectory(libclang)
- add_subdirectory(c-index-test)
add_subdirectory(arcmt-test)
add_subdirectory(c-arcmt-test)
endif()
diff --git a/tools/libclang/ARCMigrate.cpp b/tools/libclang/ARCMigrate.cpp
index 6ddc22f474..375c5f40c2 100644
--- a/tools/libclang/ARCMigrate.cpp
+++ b/tools/libclang/ARCMigrate.cpp
@@ -35,6 +35,10 @@ struct Remap {
extern "C" {
CXRemapping clang_getRemappings(const char *migrate_dir_path) {
+#ifndef CLANG_ENABLE_ARCMT
+ llvm::errs() << "error: feature not enabled in this build\n";
+ return nullptr;
+#else
bool Logging = ::getenv("LIBCLANG_LOGGING");
if (!migrate_dir_path) {
@@ -71,10 +75,15 @@ CXRemapping clang_getRemappings(const char *migrate_dir_path) {
}
return remap.release();
+#endif
}
CXRemapping clang_getRemappingsFromFileList(const char **filePaths,
unsigned numFiles) {
+#ifndef CLANG_ENABLE_ARCMT
+ llvm::errs() << "error: feature not enabled in this build\n";
+ return nullptr;
+#else
bool Logging = ::getenv("LIBCLANG_LOGGING");
std::unique_ptr<Remap> remap(new Remap());
@@ -112,6 +121,7 @@ CXRemapping clang_getRemappingsFromFileList(const char **filePaths,
}
return remap.release();
+#endif
}
unsigned clang_remap_getNumFiles(CXRemapping map) {
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index d6bbbf8a7a..e7ab63f7b9 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -37,6 +37,20 @@ set(SOURCES
../../include/clang-c/Index.h
)
+set(LIBS
+ clangAST
+ clangBasic
+ clangFrontend
+ clangIndex
+ clangLex
+ clangSema
+ clangTooling
+)
+
+if (CLANG_ENABLE_ARCMT)
+ list(APPEND LIBS clangARCMigrate)
+endif ()
+
option(LIBCLANG_BUILD_STATIC
"Build libclang as a static library (in addition to a shared one)" OFF)
@@ -69,14 +83,7 @@ add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
DEPENDS clang-headers
LINK_LIBS
- clangARCMigrate
- clangAST
- clangBasic
- clangFrontend
- clangIndex
- clangLex
- clangSema
- clangTooling
+ ${LIBS}
LINK_COMPONENTS
BitReader