From 6b1e8be121b7386a59935a20cf4ee9be2b66c813 Mon Sep 17 00:00:00 2001 From: Guillaume Fraux Date: Mon, 15 May 2017 11:38:46 +0200 Subject: [PATCH] Disable a few MSVC warnings --- tests/CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 25322d4..3ed82c7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -23,6 +23,44 @@ if(COMPILER_SUPPORTS_WPEDANTIC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic") endif() +# Disable some MSVC warnings +if(MSVC) + # conversion from 'double' to 'unsigned int', possible loss of data + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") + # conversion from 'int' to 'unsigned int', signed/unsigned mismatch + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4365") + # layout of class may have changed from a previous version of the compiler + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4371") + # enumerator in switch of enum is not explicitly handled by a case label + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4061") + # unreferenced inline function has been removed + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4514") + # constructor is not implicitly called + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4582") + # destructor is not implicitly called + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4583") + # pragma warning: there is no warning number + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4619") + # default constructor was implicitly defined as deleted + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4623") + # copy constructor was implicitly defined as deleted + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4625") + # assignment operator was implicitly defined as deleted + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4626") + # move assignment operator was implicitly defined as deleted + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4627") + # is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4668") + # function not inlined + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4710") + # function selected for automatic inlining + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4711") + # bytes padding added after data member + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4820") + # pragma warning(pop): likely mismatch, popping warning state pushed in different file + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5031") +endif() + find_package(Boost COMPONENTS unit_test_framework REQUIRED) add_definitions(-DBOOST_TEST_DYN_LINK) add_definitions(-DUNITTEST_FRAMEWORK_LIBRARY_EXIST)