[PATCH] D13690: Silence MSVC warning D9025 when /W3 present after /W4

angelsl via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 01:50:45 PDT 2015


angelsl updated this revision to Diff 37454.

http://reviews.llvm.org/D13690

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -200,8 +200,13 @@
 
 include(config-ix)
 
-if(MSVC)
-  append_string_if(COMPILER_RT_HAS_W3_FLAG /W3 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+if(MSVC AND COMPILER_RT_HAS_W3_FLAG)
+  # MSVC will give a warning if there is already another warning option.
+  # Remove any such option if present before appending /W3.
+  string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+  string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
 else()
   append_string_if(COMPILER_RT_HAS_WALL_FLAG -Wall CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13690.37454.patch
Type: text/x-patch
Size: 777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151015/eaab7098/attachment.bin>


More information about the llvm-commits mailing list