xref: /llvm-project/clang/unittests/CMakeLists.txt (revision 40c45b6b43180221acb49f387e7d3158adf49e3e)
1add_custom_target(ClangUnitTests)
2set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang/Tests")
3
4if(CLANG_BUILT_STANDALONE)
5  # LLVMTesting* libraries are needed for some of the unittests.
6  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
7      AND NOT TARGET LLVMTestingAnnotations)
8    add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
9      lib/Testing/Annotations)
10  endif()
11  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
12      AND NOT TARGET LLVMTestingSupport)
13    add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
14      lib/Testing/Support)
15  endif()
16endif()
17
18# add_clang_unittest(test_dirname file1.cpp file2.cpp)
19#
20# Will compile the list of files together and link against the clang
21# Produces a binary named 'basename(test_dirname)'.
22function(add_clang_unittest test_dirname)
23  add_unittest(ClangUnitTests ${test_dirname} ${ARGN})
24endfunction()
25
26add_subdirectory(Basic)
27add_subdirectory(Lex)
28add_subdirectory(Driver)
29if(CLANG_ENABLE_STATIC_ANALYZER)
30  add_subdirectory(Analysis)
31  add_subdirectory(StaticAnalyzer)
32endif()
33add_subdirectory(ASTMatchers)
34add_subdirectory(AST)
35add_subdirectory(CrossTU)
36add_subdirectory(Tooling)
37add_subdirectory(Format)
38add_subdirectory(Frontend)
39add_subdirectory(Rewrite)
40add_subdirectory(Sema)
41add_subdirectory(CodeGen)
42if(HAVE_CLANG_REPL_SUPPORT)
43  add_subdirectory(Interpreter)
44endif()
45# FIXME: libclang unit tests are disabled on Windows due
46# to failures, mostly in libclang.VirtualFileOverlay_*.
47if(NOT WIN32 AND CLANG_TOOL_LIBCLANG_BUILD)
48  add_subdirectory(libclang)
49endif()
50add_subdirectory(DirectoryWatcher)
51add_subdirectory(Index)
52add_subdirectory(InstallAPI)
53add_subdirectory(Serialization)
54add_subdirectory(Support)
55