From c0e926109e56aec28b7b84ce98bbd7c1f97da6c2 Mon Sep 17 00:00:00 2001 From: Mario Werner Date: Tue, 2 Feb 2016 17:14:51 +0100 Subject: [PATCH] use the same warning options like before the PR Additional notes on how to improve the current state have been added. --- CMakeLists.txt | 2 -- test/CMakeLists.txt | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5a40878..7dedd2d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,6 @@ include(testCxx11) if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wshadow -pedantic) -elseif (MSVC) - set(PEDANTIC_COMPILE_FLAGS /W4) endif () if (CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eb4d35fe..1a19a976 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,6 +39,7 @@ endif () set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc) # relax pedantic flags for the tests +# TODO: fix warnings in tests to make this redundant. (e.g. -Wshadow,...) if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wno-long-long -Wno-variadic-macros) endif () @@ -69,6 +70,13 @@ add_fmt_test(format-impl-test) add_fmt_test(printf-test) add_fmt_test(util-test mock-allocator.h) +# Enable stricter options for one test to make sure that the header is free of +# warnings. +# TODO: make all tests warning free and add this flag to PEDANTIC_COMPILE_FLAGS +if (FMT_PEDANTIC AND MSVC) + target_compile_options(format-test PRIVATE /W4) +endif () + add_executable(macro-test macro-test.cc ${TEST_MAIN_SRC}) target_link_libraries(macro-test gmock cppformat)