CMakeLists.txt revision f4932204d7cf89cc2402b1e30fb728cf84ff7b7f
1# Build for the undefined behavior sanitizer runtime support library. 2 3set(UBSAN_SOURCES 4 ubsan_diag.cc 5 ubsan_handlers.cc 6 ubsan_handlers_cxx.cc 7 ubsan_type_hash.cc 8 ubsan_value.cc 9 ) 10 11include_directories(..) 12 13set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) 14 15set(UBSAN_RUNTIME_LIBRARIES) 16 17if(CAN_TARGET_X86_64) 18 add_library(clang_rt.ubsan-x86_64 STATIC 19 ${UBSAN_SOURCES} 20 $<TARGET_OBJECTS:RTSanitizerCommon.x86_64> 21 ) 22 set_target_compile_flags(clang_rt.ubsan-x86_64 23 ${UBSAN_CFLAGS} ${TARGET_X86_64_CFLAGS} 24 ) 25 list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-x86_64) 26endif() 27 28if(CAN_TARGET_I386) 29 add_library(clang_rt.ubsan-i386 STATIC 30 ${UBSAN_SOURCES} 31 $<TARGET_OBJECTS:RTSanitizerCommon.x86_64> 32 ) 33 set_target_compile_flags(clang_rt.ubsan-i386 34 ${UBSAN_CFLAGS} ${TARGET_I386_CFLAGS} 35 ) 36 list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-i386) 37endif() 38 39set_property(TARGET ${UBSAN_RUNTIME_LIBRARIES} APPEND PROPERTY 40 COMPILE_DEFINITIONS ${UBSAN_COMMON_DEFINITIONS}) 41add_clang_compiler_rt_libraries(${UBSAN_RUNTIME_LIBRARIES}) 42 43add_subdirectory(lit_tests) 44