blob: 9c11bb6f7e61040b91d0cd402d57eb8bb2e0d51a [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>
Alexey Samsonovee03b5b2015-08-27 22:23:27 +000018 $<TARGET_OBJECTS:RTSanitizerCommonNoLibc.osx>
Chris Bienemand1602602015-08-25 19:53:09 +000019 CFLAGS ${SAFESTACK_CFLAGS}
20 PARENT_TARGET safestack)
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000021else()
22 # Otherwise, build separate libraries for each target.
23 foreach(arch ${SAFESTACK_SUPPORTED_ARCH})
Chris Bienemand1602602015-08-25 19:53:09 +000024 add_compiler_rt_runtime(clang_rt.safestack
25 STATIC
26 ARCHS ${arch}
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000027 SOURCES ${SAFESTACK_SOURCES}
28 $<TARGET_OBJECTS:RTInterception.${arch}>
29 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
Evgeniy Stepanov5a268b12015-07-23 22:05:20 +000030 $<TARGET_OBJECTS:RTSanitizerCommonNoLibc.${arch}>
Chris Bienemand1602602015-08-25 19:53:09 +000031 CFLAGS ${SAFESTACK_CFLAGS}
32 PARENT_TARGET safestack)
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000033 endforeach()
34endif()