summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-04-14 16:57:54 +0000
committerZachary Turner <zturner@google.com>2015-04-14 16:57:54 +0000
commitad84bc4c755963899cccfb181fc9e33d0c586ca4 (patch)
treee476c2068e29b4dfe3340e96261dc7f34ad9a252 /llvm/cmake/modules
parent754cf7920ba3c1a5e09b8aa516d63c0b101299d5 (diff)
downloadbcm5719-llvm-ad84bc4c755963899cccfb181fc9e33d0c586ca4.tar.gz
bcm5719-llvm-ad84bc4c755963899cccfb181fc9e33d0c586ca4.zip
[msvc] Strip /W[0-4] before appending /W4
Certain versions of CMake specify /W3 as part of CMAKE_CXX_FLAGS by default, before you do anything. Appending /W4 to the end of this and using the Ninja generator results in cl : Command line warning D9025 : overriding '/W3' with '/W4'. It is not possible to suppress this since it is a command line warning and not a compiler warning, so we must fix the command line to contain only one value for /Wn. llvm-svn: 234907
Diffstat (limited to 'llvm/cmake/modules')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index f4f96501eba..27147dcfd29 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/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)
OpenPOWER on IntegriCloud