diff --git a/CMakeLists.txt b/CMakeLists.txt index 980fd0afc..3a3335913 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()