[Sanitizer] extend internal libc with stat/fstat/lstat functions
[blocksruntime.git] / lib / sanitizer_common / CMakeLists.txt
blobc70c011a82d8546b7695470aca5a43ab2e3b43a9
1 # Build system for the common Sanitizer runtime support library components.
2 # These components are shared between AddressSanitizer and ThreadSanitizer.
4 set(SANITIZER_SOURCES
5   sanitizer_allocator.cc
6   sanitizer_common.cc
7   sanitizer_flags.cc
8   sanitizer_libc.cc
9   sanitizer_linux.cc
10   sanitizer_mac.cc
11   sanitizer_posix.cc
12   sanitizer_printf.cc
13   sanitizer_stackdepot.cc
14   sanitizer_stacktrace.cc
15   sanitizer_symbolizer.cc
16   sanitizer_symbolizer_itanium.cc
17   sanitizer_symbolizer_linux.cc
18   sanitizer_symbolizer_mac.cc
19   sanitizer_symbolizer_win.cc
20   sanitizer_win.cc
21   )
23 # Explicitly list all sanitizer_common headers. Not all of these are
24 # included in sanitizer_common source files, but we need to depend on
25 # headers when building our custom unit tests.
26 set(SANITIZER_HEADERS
27   sanitizer_allocator.h
28   sanitizer_atomic_clang.h
29   sanitizer_atomic_msvc.h
30   sanitizer_atomic.h
31   sanitizer_common.h
32   sanitizer_common_interceptors.inc
33   sanitizer_common_interceptors_scanf.inc
34   sanitizer_flags.h
35   sanitizer_internal_defs.h
36   sanitizer_lfstack.h
37   sanitizer_libc.h
38   sanitizer_list.h
39   sanitizer_mutex.h
40   sanitizer_placement_new.h
41   sanitizer_platform_interceptors.h
42   sanitizer_procmaps.h
43   sanitizer_quarantine.h
44   sanitizer_report_decorator.h
45   sanitizer_stackdepot.h
46   sanitizer_stacktrace.h
47   sanitizer_symbolizer.h
48   )
50 set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
52 set(SANITIZER_RUNTIME_LIBRARIES)
53 if(APPLE)
54   # Build universal binary on APPLE.
55   add_compiler_rt_osx_object_library(RTSanitizerCommon
56     ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH}
57     SOURCES ${SANITIZER_SOURCES}
58     CFLAGS ${SANITIZER_CFLAGS})
59   list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.osx)
60 elseif(ANDROID)
61   add_library(RTSanitizerCommon.arm.android OBJECT ${SANITIZER_SOURCES})
62   set_target_compile_flags(RTSanitizerCommon.arm.android
63     ${SANITIZER_CFLAGS})
64   list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.arm.android)
65 else()
66   # Otherwise, build separate libraries for each target.
67   foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH})
68     add_compiler_rt_object_library(RTSanitizerCommon ${arch}
69       SOURCES ${SANITIZER_SOURCES} CFLAGS ${SANITIZER_CFLAGS})
70     list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch})
71   endforeach()
72 endif()
74 # Unit tests for common sanitizer runtime.
75 if(LLVM_INCLUDE_TESTS)
76   add_subdirectory(tests)
77 endif()