summaryrefslogtreecommitdiff
path: root/cmake/modules/HandleLLVMOptions.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/HandleLLVMOptions.cmake')
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 6c99682f76..89122eee0b 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -349,3 +349,13 @@ 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_CXX_FLAGS)
+ endif()
+endif()