Browse Source

libuv: Disable warnings to avoid changing 3rd party code

Add '-w' or equivalent flag on compilers supporting it.
Tell MSVC to use its lowest warning level inside libuv sources.
Brad King 9 years ago
parent
commit
95dcc4e474
2 changed files with 12 additions and 0 deletions
  1. 8 0
      Utilities/cmlibuv/CMakeLists.txt
  2. 4 0
      Utilities/cmlibuv/src/win/internal.h

+ 8 - 0
Utilities/cmlibuv/CMakeLists.txt

@@ -1,5 +1,13 @@
 project(libuv C)
 
+# Disable warnings to avoid changing 3rd party code.
+if(CMAKE_C_COMPILER_ID MATCHES
+    "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
+elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
+endif()
+
 find_package(Threads)
 
 set(uv_libraries ${CMAKE_THREAD_LIBS_INIT})

+ 4 - 0
Utilities/cmlibuv/src/win/internal.h

@@ -22,6 +22,10 @@
 #ifndef UV_WIN_INTERNAL_H_
 #define UV_WIN_INTERNAL_H_
 
+#if defined(_MSC_VER)
+# pragma warning(push,1)
+#endif
+
 #include "uv.h"
 #include "../uv-common.h"