1 add_custom_target(LLDBUnitTests)
2 set_target_properties(LLDBUnitTests PROPERTIES FOLDER "lldb tests")
3 add_dependencies(lldb-test-deps LLDBUnitTests)
5 include_directories(${LLDB_SOURCE_ROOT})
6 include_directories(${LLDB_PROJECT_ROOT}/unittests)
8 set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/gtest_common.h)
10 list(APPEND LLVM_COMPILE_FLAGS /FI ${LLDB_GTEST_COMMON_INCLUDE})
12 list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE})
15 if (LLDB_BUILT_STANDALONE)
16 # Build the gtest library needed for unittests, if we have LLVM sources
18 if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
19 add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
21 # LLVMTestingSupport library is needed for Process/gdb-remote.
22 if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
23 AND NOT TARGET LLVMTestingSupport)
24 add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
29 function(add_lldb_unittest test_name)
30 cmake_parse_arguments(ARG
33 "LINK_LIBS;LINK_COMPONENTS"
36 list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
38 add_unittest(LLDBUnitTests
40 ${ARG_UNPARSED_ARGUMENTS}
46 COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs)
48 target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS})
51 function(add_unittest_inputs test_name inputs)
52 foreach (INPUT ${inputs})
56 COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Inputs/${INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs
57 COMMENT "Copying ${INPUT} to binary directory.")
61 add_subdirectory(TestingSupport)
62 add_subdirectory(Breakpoint)
63 add_subdirectory(Core)
64 add_subdirectory(DataFormatter)
65 add_subdirectory(Disassembler)
66 add_subdirectory(Editline)
67 add_subdirectory(Expression)
68 add_subdirectory(Host)
69 add_subdirectory(Interpreter)
70 add_subdirectory(Language)
71 add_subdirectory(ObjectFile)
72 add_subdirectory(Platform)
73 add_subdirectory(Process)
74 add_subdirectory(ScriptInterpreter)
75 add_subdirectory(Signals)
76 add_subdirectory(Symbol)
77 add_subdirectory(SymbolFile)
78 add_subdirectory(Target)
79 add_subdirectory(tools)
80 add_subdirectory(UnwindAssembly)
81 add_subdirectory(Utility)
83 if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
84 add_subdirectory(debugserver)