blob: f5d31225d46279d9b0cc9b8717b4f606fd3ef41e [file] [log] [blame]
Peter Collingbourneb64d0b12015-06-15 21:08:47 +00001add_custom_target(safestack)
2
3set(SAFESTACK_SOURCES safestack.cc)
4
5include_directories(..)
6
7set(SAFESTACK_CFLAGS ${SANITIZER_COMMON_CFLAGS})
8
9if(APPLE)
10 # Build universal binary on APPLE.
Chris Bienemand1602602015-08-25 19:53:09 +000011 add_compiler_rt_runtime(clang_rt.safestack
12 STATIC
13 OS osx
14 ARCHS ${SAFESTACK_SUPPORTED_ARCH}
15 SOURCES ${SAFESTACK_SOURCES}
16 $<TARGET_OBJECTS:RTInterception.osx>
17 $<TARGET_OBJECTS:RTSanitizerCommon.osx>
18 CFLAGS ${SAFESTACK_CFLAGS}
19 PARENT_TARGET safestack)
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000020else()
21 # Otherwise, build separate libraries for each target.
22 foreach(arch ${SAFESTACK_SUPPORTED_ARCH})
Chris Bienemand1602602015-08-25 19:53:09 +000023 add_compiler_rt_runtime(clang_rt.safestack
24 STATIC
25 ARCHS ${arch}
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000026 SOURCES ${SAFESTACK_SOURCES}
27 $<TARGET_OBJECTS:RTInterception.${arch}>
28 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
Evgeniy Stepanov5a268b12015-07-23 22:05:20 +000029 $<TARGET_OBJECTS:RTSanitizerCommonNoLibc.${arch}>
Chris Bienemand1602602015-08-25 19:53:09 +000030 CFLAGS ${SAFESTACK_CFLAGS}
31 PARENT_TARGET safestack)
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000032 endforeach()
33endif()