summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-02-05 15:21:37 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-02-05 17:17:18 +0000
commitf8a2dda8266e09540b9821e20bf081da2355b105 (patch)
treed8bffd2abc835f0f38b6a8050ef6807ab5b79d1a /cmake
parentfc6e38c2fc4fb1f97ad17f45d1a165ef4211936c (diff)
downloadlibgit2-f8a2dda8266e09540b9821e20bf081da2355b105.tar.gz
cmake: move ENABLE_WARNINGS to a moduleethomson/cmake_fixes
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/EnableWarnings.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/Modules/EnableWarnings.cmake b/cmake/Modules/EnableWarnings.cmake
new file mode 100644
index 000000000..e7d7d3986
--- /dev/null
+++ b/cmake/Modules/EnableWarnings.cmake
@@ -0,0 +1,14 @@
+MACRO(ENABLE_WARNINGS flag)
+ IF(ENABLE_WERROR)
+ ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag})
+ ELSE()
+ ADD_C_FLAG_IF_SUPPORTED(-W${flag})
+ ENDIF()
+ENDMACRO()
+
+MACRO(DISABLE_WARNINGS flag)
+ ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag})
+ IF(ENABLE_WERROR)
+ ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag})
+ ENDIF()
+ENDMACRO()