1add_custom_target(safestack)
2set_target_properties(safestack PROPERTIES
3  FOLDER "Compiler-RT Misc")
4
5set(SAFESTACK_SOURCES safestack.cc)
6
7include_directories(..)
8
9set(SAFESTACK_CFLAGS ${SANITIZER_COMMON_CFLAGS})
10
11if(APPLE)
12  # Build universal binary on APPLE.
13  add_compiler_rt_runtime(clang_rt.safestack
14    STATIC
15    OS osx
16    ARCHS ${SAFESTACK_SUPPORTED_ARCH}
17    SOURCES ${SAFESTACK_SOURCES}
18            $<TARGET_OBJECTS:RTInterception.osx>
19            $<TARGET_OBJECTS:RTSanitizerCommon.osx>
20            $<TARGET_OBJECTS:RTSanitizerCommonNoLibc.osx>
21    CFLAGS ${SAFESTACK_CFLAGS}
22    PARENT_TARGET safestack)
23else()
24  # Otherwise, build separate libraries for each target.
25  foreach(arch ${SAFESTACK_SUPPORTED_ARCH})
26    add_compiler_rt_runtime(clang_rt.safestack
27      STATIC
28      ARCHS ${arch}
29      SOURCES ${SAFESTACK_SOURCES}
30              $<TARGET_OBJECTS:RTInterception.${arch}>
31              $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
32              $<TARGET_OBJECTS:RTSanitizerCommonNoLibc.${arch}>
33      CFLAGS ${SAFESTACK_CFLAGS}
34      PARENT_TARGET safestack)
35  endforeach()
36endif()
37