Remove -arm-enable-ehabi from Android build rules. It's enabled by default.
[oota-llvm.git] / cmake / modules / HandleLLVMOptions.cmake
index 6c99682f76698213b5477ee0c6289576d854d584..487b2e45808fe53fb67f3e4b2e49b510083c44bf 100644 (file)
@@ -349,3 +349,21 @@ if (UNIX AND
     CMAKE_GENERATOR STREQUAL "Ninja")
   append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 endif()
+
+# Add flags for add_dead_strip().
+# FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
+# But MinSizeRel seems to add that automatically, so maybe disable these
+# flags instead if LLVM_NO_DEAD_STRIP is set.
+if(NOT CYGWIN AND NOT WIN32)
+  if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    append("-ffunction-sections -fdata-sections" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+  endif()
+endif()
+
+if(MSVC)
+  # Remove flags here, for exceptions and RTTI.
+  # Each target property of source proerty should be responsible to control them.
+  # CL.EXE complains to override flags like "/GR /GR-".
+  string(REGEX REPLACE "(^| ) */EH[-cs]+ *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+  string(REGEX REPLACE "(^| ) */GR-? *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+endif()