[cmake] Work around -Wunused-driver-argument warnings

Fix the Darwin logic so that -msse3 is only used on macOS, and
-fomit-frame-pointer is not used on armv7/armv7k/armv7s.

llvm-svn: 312390
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 64a8e03..032b437 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -125,8 +125,16 @@
   else()
     set(NO_LTO_FLAGS "")
   endif()
+
   if(APPLE)
     foreach(os ${LIB_OS})
+      # Strip out -msse3 if this isn't macOS.
+      message(WARNING "BEFORE: ${LIB_CFLAGS}")
+      list(LENGTH LIB_CFLAGS HAS_EXTRA_CFLAGS)
+      if(HAS_EXTRA_CFLAGS AND NOT "${os}" MATCHES "^(osx)$")
+        list(REMOVE_ITEM LIB_CFLAGS "-msse3")
+      endif()
+      message(WARNING "AFTER: ${LIB_CFLAGS}")
       if(type STREQUAL "STATIC")
         set(libname "${name}_${os}")
       else()