xref: /aosp_15_r20/external/compiler-rt/test/cfi/CMakeLists.txt (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robotset(CFI_LIT_TEST_MODE Standalone)
2*7c3d14c8STreehugger Robotconfigure_lit_site_cfg(
3*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
4*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_BINARY_DIR}/Standalone/lit.site.cfg
5*7c3d14c8STreehugger Robot  )
6*7c3d14c8STreehugger Robot
7*7c3d14c8STreehugger Robotset(CFI_LIT_TEST_MODE Devirt)
8*7c3d14c8STreehugger Robotconfigure_lit_site_cfg(
9*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
10*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_BINARY_DIR}/Devirt/lit.site.cfg
11*7c3d14c8STreehugger Robot  )
12*7c3d14c8STreehugger Robot
13*7c3d14c8STreehugger Robotset(CFI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
14*7c3d14c8STreehugger Robotif(NOT COMPILER_RT_STANDALONE_BUILD)
15*7c3d14c8STreehugger Robot  list(APPEND CFI_TEST_DEPS
16*7c3d14c8STreehugger Robot    opt
17*7c3d14c8STreehugger Robot    ubsan
18*7c3d14c8STreehugger Robot    stats
19*7c3d14c8STreehugger Robot    sanstats
20*7c3d14c8STreehugger Robot  )
21*7c3d14c8STreehugger Robot  if(COMPILER_RT_HAS_CFI)
22*7c3d14c8STreehugger Robot    list(APPEND CFI_TEST_DEPS cfi)
23*7c3d14c8STreehugger Robot  endif()
24*7c3d14c8STreehugger Robot  if(LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR)
25*7c3d14c8STreehugger Robot    list(APPEND CFI_TEST_DEPS
26*7c3d14c8STreehugger Robot      LLVMgold
27*7c3d14c8STreehugger Robot    )
28*7c3d14c8STreehugger Robot  endif()
29*7c3d14c8STreehugger Robot  if(APPLE)
30*7c3d14c8STreehugger Robot    list(APPEND CFI_TEST_DEPS
31*7c3d14c8STreehugger Robot      LTO
32*7c3d14c8STreehugger Robot    )
33*7c3d14c8STreehugger Robot  endif()
34*7c3d14c8STreehugger Robot  if(WIN32 AND COMPILER_RT_HAS_LLD_SOURCES)
35*7c3d14c8STreehugger Robot    list(APPEND CFI_TEST_DEPS
36*7c3d14c8STreehugger Robot      lld
37*7c3d14c8STreehugger Robot    )
38*7c3d14c8STreehugger Robot  endif()
39*7c3d14c8STreehugger Robotendif()
40*7c3d14c8STreehugger Robot
41*7c3d14c8STreehugger Robotadd_lit_testsuite(check-cfi "Running the cfi regression tests"
42*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_BINARY_DIR}/Standalone
43*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_BINARY_DIR}/Devirt
44*7c3d14c8STreehugger Robot  DEPENDS ${CFI_TEST_DEPS})
45*7c3d14c8STreehugger Robot
46*7c3d14c8STreehugger Robotadd_lit_target(check-cfi-and-supported "Running the cfi regression tests"
47*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_BINARY_DIR}/Standalone
48*7c3d14c8STreehugger Robot  ${CMAKE_CURRENT_BINARY_DIR}/Devirt
49*7c3d14c8STreehugger Robot  PARAMS check_supported=1
50*7c3d14c8STreehugger Robot  DEPENDS ${CFI_TEST_DEPS})
51*7c3d14c8STreehugger Robot
52*7c3d14c8STreehugger Robotset_target_properties(check-cfi PROPERTIES FOLDER "Compiler-RT Misc")
53*7c3d14c8STreehugger Robotset_target_properties(check-cfi-and-supported PROPERTIES FOLDER "Compiler-RT Misc")
54