Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxxabi / test / CMakeLists.txt
blob9f95c736d63f464f00e3907ae42297753dbd39e2
1 include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
2 include(HandleLitArguments)
3 macro(pythonize_bool var)
4   if (${var})
5     set(${var} True)
6   else()
7     set(${var} False)
8   endif()
9 endmacro()
11 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
13 if (LIBCXXABI_ENABLE_SHARED)
14   set(LIBCXXABI_TEST_DEPS cxxabi_shared)
15 else()
16   set(LIBCXXABI_TEST_DEPS cxxabi_static)
17 endif()
19 list(APPEND LIBCXXABI_TEST_DEPS cxx)
20 if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
21   list(APPEND LIBCXXABI_TEST_DEPS unwind)
22 endif()
24 set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
25 set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
27 if (LIBCXXABI_EXECUTOR)
28   message(DEPRECATION "LIBCXXABI_EXECUTOR is deprecated, please add executor=... to LIBCXXABI_TEST_PARAMS")
29   serialize_lit_string_param(SERIALIZED_LIT_PARAMS executor "${LIBCXXABI_EXECUTOR}")
30 endif()
32 if (NOT LIBCXXABI_ENABLE_EXCEPTIONS)
33   serialize_lit_param(SERIALIZED_LIT_PARAMS enable_exceptions False)
34 endif()
36 if (LIBCXXABI_ENABLE_ASSERTIONS)
37   serialize_lit_param(SERIALIZED_LIT_PARAMS enable_assertions True)
38 endif()
40 serialize_lit_param(SERIALIZED_LIT_PARAMS enable_experimental False)
42 if (LLVM_USE_SANITIZER)
43   serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_sanitizer "${LLVM_USE_SANITIZER}")
44 endif()
46 if (CMAKE_CXX_COMPILER_TARGET)
47   serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${CMAKE_CXX_COMPILER_TARGET}")
48 else()
49   serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${LLVM_DEFAULT_TARGET_TRIPLE}")
50 endif()
52 serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBCXXABI_TEST_PARAMS)
54 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in"
55                "${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg"
56                @ONLY)
58 configure_lit_site_cfg(
59   "${LIBCXXABI_TEST_CONFIG}"
60   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
61   MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
63 add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
64   ${CMAKE_CURRENT_BINARY_DIR}
65   DEPENDS ${LIBCXXABI_TEST_DEPS})