Skip to content

Commit

Permalink
cmake: Add MSVC flags for Wall, Wno-sign-compare and Werror
Browse files Browse the repository at this point in the history
This will bring the Windows AppVeyor builds to the same as the other
CI infrastructure, and will stop and error on any warnings.

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed May 1, 2020
1 parent a0994c5 commit 2e9d236
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ if (WITH_TESTS)
endif()

if (MSVC)
# Avoid annoying warnings from Visual Studio
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)

add_compile_options(/W4 /wd4018 /wd4200 /wd4127 /wd4100)
# C4018: signed/unsigned mismatch ; same as -Wno-sign-compare
# C4200: nonstandard extension used : zero-sized array in struct (usb.h)
# C4127: conditional expression is constant (IIO_ERROR and IIO_DEBUG macros)
# C4100: unreferenced parameter; same as -Wno-unused-parameter

if(DEFINED ENV{CI} AND DEFINED ENV{APPVEYOR})
message(STATUS "Running in an AppVeyor environment, setting -Werror")
add_compile_options(/WX)
endif()
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
endif()
Expand Down

0 comments on commit 2e9d236

Please sign in to comment.