[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / unittests / CMakeLists.txt
blobbf117030dd4b6556bfc7c56b432430cac2d5faa0
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)
9 if (MSVC)
10   list(APPEND LLVM_COMPILE_FLAGS /FI ${LLDB_GTEST_COMMON_INCLUDE})
11 else ()
12   list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE})
13 endif ()
15 if (LLDB_BUILT_STANDALONE)
16   # Build the gtest library needed for unittests, if we have LLVM sources
17   # handy.
18   if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
19     add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
20   endif()
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
25       lib/Testing/Support)
26   endif()
27 endif()
29 function(add_lldb_unittest test_name)
30   cmake_parse_arguments(ARG
31     ""
32     ""
33     "LINK_LIBS;LINK_COMPONENTS"
34     ${ARGN})
36   list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
38   add_unittest(LLDBUnitTests
39     ${test_name}
40     ${ARG_UNPARSED_ARGUMENTS}
41     )
43   add_custom_command(
44     TARGET ${test_name}
45     POST_BUILD
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})
49 endfunction()
51 function(add_unittest_inputs test_name inputs)
52   foreach (INPUT ${inputs})
53     add_custom_command(
54       TARGET ${test_name}
55       POST_BUILD
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.")
58   endforeach()
59 endfunction()
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)
85 endif()