shithub: opus

Download patch

ref: edccc331601d0225b8ec91edcfb82f27a9279cb2
parent: 982e83a75004ec403bfbeb6d8fe84fa07d4885f6
author: Marcus Asteborg <maastebo@microsoft.com>
date: Wed Jun 24 03:05:09 EDT 2020

cmake - add warning flags for clang, gcc etc.

--- a/cmake/OpusConfig.cmake
+++ b/cmake/OpusConfig.cmake
@@ -78,3 +78,15 @@
   check_flag(STACK_PROTECTOR -fstack-protector-strong)
   check_flag(HIDDEN_VISIBILITY -fvisibility=hidden)
 endif()
+
+if(NOT MSVC)
+  set(WARNING_LIST -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -Wshadow)
+  include(CheckCCompilerFlag)
+  foreach(WARNING_FLAG ${WARNING_LIST})
+    string(REPLACE - "" WARNING_VAR ${WARNING_FLAG})
+    check_c_compiler_flag(${WARNING_FLAG} ${WARNING_VAR}_SUPPORTED)
+    if(${WARNING_VAR}_SUPPORTED)
+      add_compile_options(${WARNING_FLAG})
+    endif()
+  endforeach()
+endif()
\ No newline at end of file