]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/interception/CMakeLists.txt
Import compiler-rt r160957.
[FreeBSD/FreeBSD.git] / lib / interception / CMakeLists.txt
1 # Build for the runtime interception helper library.
2
3 set(INTERCEPTION_SOURCES
4   interception_linux.cc
5   interception_mac.cc
6   interception_win.cc
7   )
8
9 # Only add this C file if we're building on a Mac. Other source files can be
10 # harmlessly compiled on any platform, but the C file is complained about due
11 # to pedantic rules about empty translation units.
12 if (APPLE)
13   list(APPEND INTERCEPTION_SOURCES mach_override/mach_override.c)
14 endif ()
15
16 set(INTERCEPTION_CFLAGS "-fPIC -fno-exceptions -funwind-tables -fvisibility=hidden")
17 if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
18   set(INTERCEPTION_CFLAGS "${INTERCEPTION_CFLAGS} -Wno-variadic-macros")
19 endif ()
20
21 set(INTERCEPTION_COMMON_DEFINITIONS
22         INTERCEPTION_HAS_EXCEPTIONS=1)
23
24 if(CAN_TARGET_X86_64)
25   add_library(RTInterception.x86_64 OBJECT ${INTERCEPTION_SOURCES})
26   set_property(TARGET RTInterception.x86_64 PROPERTY COMPILE_FLAGS
27                 "${INTERCEPTION_CFLAGS} ${TARGET_X86_64_CFLAGS}")
28   set_property(TARGET RTInterception.x86_64 APPEND PROPERTY COMPILE_DEFINITIONS
29                 ${INTERCEPTION_COMMON_DEFINITIONS})
30 endif()
31 if(CAN_TARGET_I386)
32   add_library(RTInterception.i386 OBJECT ${INTERCEPTION_SOURCES})
33   set_property(TARGET RTInterception.i386 PROPERTY COMPILE_FLAGS
34                 "${INTERCEPTION_CFLAGS} ${TARGET_I386_CFLAGS}")
35   set_property(TARGET RTInterception.i386 APPEND PROPERTY COMPILE_DEFINITIONS
36                 ${INTERCEPTION_COMMON_DEFINITIONS})
37 endif()