aboutsummaryrefslogtreecommitdiff
path: root/lib/interception/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'lib/interception/CMakeLists.txt')
-rw-r--r--lib/interception/CMakeLists.txt44
1 files changed, 23 insertions, 21 deletions
diff --git a/lib/interception/CMakeLists.txt b/lib/interception/CMakeLists.txt
index 033b05fc1b34..ca59f2b8211e 100644
--- a/lib/interception/CMakeLists.txt
+++ b/lib/interception/CMakeLists.txt
@@ -6,32 +6,34 @@ set(INTERCEPTION_SOURCES
interception_win.cc
)
+set(MACH_OVERRIDE_SOURCES
+ mach_override/mach_override.c
+ )
+
# Only add this C file if we're building on a Mac. Other source files can be
# harmlessly compiled on any platform, but the C file is complained about due
# to pedantic rules about empty translation units.
if (APPLE)
- list(APPEND INTERCEPTION_SOURCES mach_override/mach_override.c)
+ list(APPEND INTERCEPTION_SOURCES ${MACH_OVERRIDE_SOURCES})
+ set_source_files_properties(${MACH_OVERRIDE_SOURCES} PROPERTIES COMPILE_FLAGS "-std=c99 ${INTERCEPTION_CFLAGS}")
endif ()
-set(INTERCEPTION_CFLAGS "-fPIC -fno-exceptions -funwind-tables -fvisibility=hidden")
-if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
- set(INTERCEPTION_CFLAGS "${INTERCEPTION_CFLAGS} -Wno-variadic-macros")
-endif ()
+set(INTERCEPTION_CFLAGS ${SANITIZER_COMMON_CFLAGS})
-set(INTERCEPTION_COMMON_DEFINITIONS
- INTERCEPTION_HAS_EXCEPTIONS=1)
-
-if(CAN_TARGET_X86_64)
- add_library(RTInterception.x86_64 OBJECT ${INTERCEPTION_SOURCES})
- set_property(TARGET RTInterception.x86_64 PROPERTY COMPILE_FLAGS
- "${INTERCEPTION_CFLAGS} ${TARGET_X86_64_CFLAGS}")
- set_property(TARGET RTInterception.x86_64 APPEND PROPERTY COMPILE_DEFINITIONS
- ${INTERCEPTION_COMMON_DEFINITIONS})
-endif()
-if(CAN_TARGET_I386)
- add_library(RTInterception.i386 OBJECT ${INTERCEPTION_SOURCES})
- set_property(TARGET RTInterception.i386 PROPERTY COMPILE_FLAGS
- "${INTERCEPTION_CFLAGS} ${TARGET_I386_CFLAGS}")
- set_property(TARGET RTInterception.i386 APPEND PROPERTY COMPILE_DEFINITIONS
- ${INTERCEPTION_COMMON_DEFINITIONS})
+if(APPLE)
+ # Build universal binary on APPLE.
+ add_library(RTInterception.osx OBJECT ${INTERCEPTION_SOURCES})
+ set_target_compile_flags(RTInterception.osx ${INTERCEPTION_CFLAGS})
+ set_target_properties(RTInterception.osx PROPERTIES
+ OSX_ARCHITECTURES "${SANITIZER_COMMON_SUPPORTED_ARCH}")
+elseif(ANDROID)
+ add_library(RTInterception.arm.android OBJECT ${INTERCEPTION_SOURCES})
+ set_target_compile_flags(RTInterception.arm.android
+ ${INTERCEPTION_CFLAGS})
+else()
+ # Otherwise, build separate libraries for each target.
+ foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH})
+ add_compiler_rt_object_library(RTInterception ${arch}
+ SOURCES ${INTERCEPTION_SOURCES} CFLAGS ${INTERCEPTION_CFLAGS})
+ endforeach()
endif()