summaryrefslogtreecommitdiffstats
path: root/cmake/EnableWarnings.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/EnableWarnings.cmake')
-rw-r--r--cmake/EnableWarnings.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/EnableWarnings.cmake b/cmake/EnableWarnings.cmake
new file mode 100644
index 0000000..0700b52
--- /dev/null
+++ b/cmake/EnableWarnings.cmake
@@ -0,0 +1,15 @@
+macro(ENABLE_WARNINGS flag)
+ add_c_flag_if_supported(-W${flag})
+endmacro()
+
+macro(DISABLE_WARNINGS flag)
+ add_c_flag_if_supported(-Wno-${flag})
+endmacro()
+
+if(ENABLE_WERROR)
+ if(MSVC)
+ add_compile_options(-WX)
+ else()
+ add_c_flag_if_supported(-Werror)
+ endif()
+endif()