[runtimes] Pass-through CLANG_RESOURCE_DIR to cmake invocations (#73185)
[llvm-project.git] / libunwind / test / CMakeLists.txt
blob21dfbb0a84f0a80016bdee317d910c299e285b39
1 include(AddLLVM) # for 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(LIBUNWIND_ENABLE_CET)
12 pythonize_bool(LIBUNWIND_ENABLE_THREADS)
13 pythonize_bool(LIBUNWIND_USES_ARM_EHABI)
15 set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not edit!")
16 set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
18 if (LIBUNWIND_EXECUTOR)
19   message(DEPRECATION "LIBUNWIND_EXECUTOR is deprecated, please add executor=... to LIBUNWIND_TEST_PARAMS")
20   serialize_lit_string_param(SERIALIZED_LIT_PARAMS executor "${LIBUNWIND_EXECUTOR}")
21 endif()
23 serialize_lit_param(SERIALIZED_LIT_PARAMS enable_experimental False)
25 if (LLVM_USE_SANITIZER)
26   serialize_lit_string_param(SERIALIZED_LIT_PARAMS use_sanitizer "${LLVM_USE_SANITIZER}")
27 endif()
29 if (CMAKE_CXX_COMPILER_TARGET)
30   serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${CMAKE_CXX_COMPILER_TARGET}")
31 else()
32   serialize_lit_string_param(SERIALIZED_LIT_PARAMS target_triple "${LLVM_DEFAULT_TARGET_TRIPLE}")
33 endif()
35 serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBUNWIND_TEST_PARAMS)
37 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in"
38                "${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg"
39                @ONLY)
41 configure_lit_site_cfg(
42   "${LIBUNWIND_TEST_CONFIG}"
43   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
44   MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
46 add_lit_testsuite(check-unwind "Running libunwind tests"
47   ${CMAKE_CURRENT_BINARY_DIR}
48   DEPENDS unwind ${LIBUNWIND_TEST_DEPS})