blob: bf843ffe94018ff2ac290776bbe46a10c7788614 [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 Bienemand8b76ce2015-08-18 18:35:18 +000011 foreach (os osx)
Chris Bieneman201d0652015-08-18 17:32:18 +000012 add_compiler_rt_darwin_runtime(clang_rt.safestack_${os} ${os}
13 STATIC
Kuba Brecka746da5f2015-08-19 14:03:51 +000014 ARCHS ${SAFESTACK_SUPPORTED_ARCH}
Chris Bieneman201d0652015-08-18 17:32:18 +000015 SOURCES ${SAFESTACK_SOURCES}
16 $<TARGET_OBJECTS:RTInterception.${os}>
17 $<TARGET_OBJECTS:RTSanitizerCommon.${os}>
18 CFLAGS ${SAFESTACK_CFLAGS})
19 add_dependencies(safestack clang_rt.safestack_${os})
20 endforeach()
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000021else()
22 # Otherwise, build separate libraries for each target.
23 foreach(arch ${SAFESTACK_SUPPORTED_ARCH})
24 add_compiler_rt_runtime(clang_rt.safestack-${arch} ${arch} STATIC
25 SOURCES ${SAFESTACK_SOURCES}
26 $<TARGET_OBJECTS:RTInterception.${arch}>
27 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
Evgeniy Stepanov5a268b12015-07-23 22:05:20 +000028 $<TARGET_OBJECTS:RTSanitizerCommonNoLibc.${arch}>
Peter Collingbourneb64d0b12015-06-15 21:08:47 +000029 CFLAGS ${SAFESTACK_CFLAGS})
30 add_dependencies(safestack clang_rt.safestack-${arch})
31 endforeach()
32endif()