Skip to content

Commit

Permalink
CMake: Set warning options for MSVC so we can enable /WX
Browse files Browse the repository at this point in the history
Reduce default set from /W3 to /W2 and disable two
additional warnings that we do not care about.

With these settings successful builds with /WX are possible.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
  • Loading branch information
flichtenheld committed Aug 3, 2023
1 parent d7e8375 commit aec6902
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmake/findcoredeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ function(add_core_dependencies target)
endif ()

if (MSVC)
# I think this is too much currently
# target_compile_options(${target} PRIVATE /W4)
# C4200: nonstandard extension used : zero-sized array in struct/union
# C4146: unary minus operator applied to unsigned type, result still unsigned
target_compile_options(${target} PRIVATE /W2 /wd4200 /wd4146)
else()
target_compile_options(${target} PRIVATE -Wall -Wsign-compare)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down

0 comments on commit aec6902

Please sign in to comment.