summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-06-15 18:51:40 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-06-24 17:27:22 +0100
commitcc9e47c995fc9bb5526f8e83a27c5f2af6a6f6d9 (patch)
treef7685dcc4bb9b0fee4bbda614ffb4de5dccc6e8b /cmake
parentf6530438f476220547ad46fcc1bfcc0f796f7733 (diff)
downloadlibgit2-cc9e47c995fc9bb5526f8e83a27c5f2af6a6f6d9.tar.gz
win32: support upgrading warnings to errors (/WX)
For MSVC, support warnings as errors by providing the /WX compiler flags. (/WX is the moral equivalent of -Werror.) Disable warnings as errors ass part of xdiff, since it contains warnings. But as a component of git itself, we want to avoid skew and keep our implementation as similar as possible to theirs. We'll work with upstream to fix these issues, but in the meantime, simply let those continue to warn.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/EnableWarnings.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmake/Modules/EnableWarnings.cmake b/cmake/Modules/EnableWarnings.cmake
index 72e1523c4..b61ed7e90 100644
--- a/cmake/Modules/EnableWarnings.cmake
+++ b/cmake/Modules/EnableWarnings.cmake
@@ -7,5 +7,9 @@ MACRO(DISABLE_WARNINGS flag)
ENDMACRO()
IF(ENABLE_WERROR)
- ADD_C_FLAG_IF_SUPPORTED(-Werror)
+ IF(MSVC)
+ ADD_COMPILE_OPTIONS(-WX)
+ ELSE()
+ ADD_C_FLAG_IF_SUPPORTED(-Werror)
+ ENDIF()
ENDIF()