CMakeLists.txt revision b404b55b4f575fd57519bca3212d7d27c44fa26a
1include_directories(..)
2
3# Runtime library sources and build flags.
4set(DFSAN_RTL_SOURCES
5  dfsan.cc)
6
7set(DFSAN_RTL_CFLAGS
8  ${SANITIZER_COMMON_CFLAGS}
9  # Prevent clang from generating libc calls.
10  -ffreestanding)
11
12# Static runtime library.
13set(DFSAN_RUNTIME_LIBRARIES)
14set(arch "x86_64")
15if(CAN_TARGET_${arch})
16  add_compiler_rt_static_runtime(clang_rt.dfsan-${arch} ${arch}
17    SOURCES ${DFSAN_RTL_SOURCES}
18            $<TARGET_OBJECTS:RTInterception.${arch}>
19            $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
20            $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
21    CFLAGS ${DFSAN_RTL_CFLAGS} -fPIE)
22  add_compiler_rt_static_runtime(clang_rt.dfsan-libc-${arch} ${arch}
23    SOURCES ${DFSAN_RTL_SOURCES}
24            $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
25            CFLAGS ${DFSAN_RTL_CFLAGS} -fPIC -DDFSAN_NOLIBC)
26  list(APPEND DFSAN_RUNTIME_LIBRARIES clang_rt.dfsan-${arch})
27endif()
28
29add_subdirectory(lit_tests)
30