aboutsummaryrefslogtreecommitdiffstats
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, 9 insertions, 1 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 67f86a6..27147dc 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -315,6 +315,13 @@ if( MSVC )
# Enable warnings
if (LLVM_ENABLE_WARNINGS)
append("/W4" msvc_warning_flags)
+ # CMake appends /W3 by default, and having /W3 followed by /W4 will result in
+ # cl : Command line warning D9025 : overriding '/W3' with '/W4'. Since this is
+ # a command line warning and not a compiler warning, it cannot be suppressed except
+ # by fixing the command line.
+ string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+
if (LLVM_ENABLE_PEDANTIC)
# No MSVC equivalent available
endif (LLVM_ENABLE_PEDANTIC)
@@ -486,7 +493,8 @@ endif()
# 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")
+ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
+ NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
check_c_compiler_flag("-Werror -fno-function-sections" C_SUPPORTS_FNO_FUNCTION_SECTIONS)
if (C_SUPPORTS_FNO_FUNCTION_SECTIONS)
# Don't add -ffunction-section if it can be disabled with -fno-function-sections.