[Sanitizer] cleanup CMake files for interception and sanitizer_common helper libraries

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161485 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/interception/CMakeLists.txt b/lib/interception/CMakeLists.txt
index 033b05f..3ebeb61 100644
--- a/lib/interception/CMakeLists.txt
+++ b/lib/interception/CMakeLists.txt
@@ -13,25 +13,30 @@
   list(APPEND INTERCEPTION_SOURCES mach_override/mach_override.c)
 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
+  -O3
+  -fPIC
+  -fno-exceptions
+  -funwind-tables
+  -fvisibility=hidden
+  )
+if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
+  list(APPEND INTERCEPTION_CFLAGS -Wno-variadic-macros)
+endif()
 
-set(INTERCEPTION_COMMON_DEFINITIONS
-	INTERCEPTION_HAS_EXCEPTIONS=1)
+set(INTERCEPTION_COMMON_DEFINITIONS)
 
 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})
+  set_target_compile_flags(RTInterception.x86_64
+    ${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})
+  set_target_compile_flags(RTInterception.i386
+    ${INTERCEPTION_CFLAGS} ${TARGET_I386_CFLAGS})
+  set_property(TARGET RTInterception.i386 APPEND PROPERTY
+    COMPILE_DEFINITIONS ${INTERCEPTION_COMMON_DEFINITIONS})
 endif()
diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
index 5c55f43..7780f0b 100644
--- a/lib/sanitizer_common/CMakeLists.txt
+++ b/lib/sanitizer_common/CMakeLists.txt
@@ -15,23 +15,27 @@
   sanitizer_win.cc
   )
 
-set(SANITIZER_CFLAGS "-fPIC -fno-exceptions -funwind-tables -fvisibility=hidden")
-
-set(SANITIZER_COMMON_DEFINITIONS
-  SANITIZER_HAS_EXCEPTIONS=1
+set(SANITIZER_CFLAGS
+  -O3
+  -fPIC
+  -fno-exceptions
+  -funwind-tables
+  -fvisibility=hidden
   )
 
+set(SANITIZER_COMMON_DEFINITIONS)
+
 if(CAN_TARGET_X86_64)
   add_library(RTSanitizerCommon.x86_64 OBJECT ${SANITIZER_SOURCES})
-  set_property(TARGET RTSanitizerCommon.x86_64 PROPERTY COMPILE_FLAGS
-		"${SANITIZER_CFLAGS} ${TARGET_X86_64_CFLAGS}")
-  set_property(TARGET RTSanitizerCommon.x86_64 APPEND PROPERTY COMPILE_DEFINITIONS
-		${SANITIZER_COMMON_DEFINITIONS})
+  set_target_compile_flags(RTSanitizerCommon.x86_64
+    ${SANITIZER_CFLAGS} ${TARGET_X86_64_CFLAGS})
+  set_property(TARGET RTSanitizerCommon.x86_64 APPEND PROPERTY
+    COMPILE_DEFINITIONS ${SANITIZER_COMMON_DEFINITIONS})
 endif()
 if(CAN_TARGET_I386)
   add_library(RTSanitizerCommon.i386 OBJECT ${SANITIZER_SOURCES})
-  set_property(TARGET RTSanitizerCommon.i386 PROPERTY COMPILE_FLAGS
-		"${SANITIZER_CFLAGS} ${TARGET_I386_CFLAGS}")
-  set_property(TARGET RTSanitizerCommon.i386 APPEND PROPERTY COMPILE_DEFINITIONS
-		${SANITIZER_COMMON_DEFINITIONS})
+  set_target_compile_flags(RTSanitizerCommon.i386
+    ${SANITIZER_CFLAGS} ${TARGET_I386_CFLAGS})
+  set_property(TARGET RTSanitizerCommon.i386 APPEND PROPERTY
+    COMPILE_DEFINITIONS ${SANITIZER_COMMON_DEFINITIONS})
 endif()