[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / lldb / unittests / CMakeLists.txt
blobc084fa5cca92b3f1fb46cc5c3ba881f84f13d71f
1 add_custom_target(LLDBUnitTests)
2 set_target_properties(LLDBUnitTests PROPERTIES FOLDER "lldb tests")
4 add_dependencies(lldb-unit-test-deps LLDBUnitTests)
6 include_directories(${LLDB_SOURCE_ROOT})
7 include_directories(${LLDB_PROJECT_ROOT}/unittests)
9 if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
10   add_compile_options("-Wno-suggest-override")
11 endif()
13 function(add_lldb_unittest test_name)
14   cmake_parse_arguments(ARG
15     ""
16     ""
17     "LINK_LIBS;LINK_COMPONENTS"
18     ${ARGN})
20   if (NOT ${test_name} MATCHES "Tests$")
21     message(FATAL_ERROR "Unit test name must end with 'Tests' for lit to find it.")
22   endif()
24   list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
26   add_unittest(LLDBUnitTests
27     ${test_name}
28     ${ARG_UNPARSED_ARGUMENTS}
29     )
31   add_custom_command(
32     TARGET ${test_name}
33     POST_BUILD
34     COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs)
36   target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS})
37 endfunction()
39 function(add_unittest_inputs test_name inputs)
40   foreach (INPUT ${inputs})
41     add_custom_command(
42       TARGET ${test_name}
43       POST_BUILD
44       COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Inputs/${INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs
45       COMMENT "Copying ${INPUT} to binary directory.")
46   endforeach()
47 endfunction()
49 add_subdirectory(TestingSupport)
50 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
51   # FIXME: APITests.exe is not a valid googletest binary.
52   add_subdirectory(API)
53 endif()
54 add_subdirectory(Breakpoint)
55 add_subdirectory(Core)
56 add_subdirectory(DataFormatter)
57 add_subdirectory(Disassembler)
58 add_subdirectory(Editline)
59 add_subdirectory(Expression)
60 add_subdirectory(Host)
61 add_subdirectory(Interpreter)
62 add_subdirectory(Instruction)
63 add_subdirectory(Language)
64 add_subdirectory(ObjectFile)
65 add_subdirectory(Platform)
66 add_subdirectory(Process)
67 add_subdirectory(ScriptInterpreter)
68 add_subdirectory(Signals)
69 add_subdirectory(Symbol)
70 add_subdirectory(SymbolFile)
71 add_subdirectory(Target)
72 add_subdirectory(tools)
73 add_subdirectory(UnwindAssembly)
74 add_subdirectory(Utility)
75 add_subdirectory(Thread)
77 if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
78   add_subdirectory(debugserver)
79 endif()