use the same warning options like before the PR

Additional notes on how to improve the current state have been added.
This commit is contained in:
Mario Werner 2016-02-02 17:14:51 +01:00
parent b05a02b91c
commit c0e926109e
2 changed files with 8 additions and 2 deletions

View File

@ -39,8 +39,6 @@ include(testCxx11)
if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wshadow -pedantic) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wshadow -pedantic)
elseif (MSVC)
set(PEDANTIC_COMPILE_FLAGS /W4)
endif () endif ()
if (CMAKE_GENERATOR MATCHES "Visual Studio") if (CMAKE_GENERATOR MATCHES "Visual Studio")

View File

@ -39,6 +39,7 @@ endif ()
set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc) set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc)
# relax pedantic flags for the tests # 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")) 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) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wno-long-long -Wno-variadic-macros)
endif () endif ()
@ -69,6 +70,13 @@ add_fmt_test(format-impl-test)
add_fmt_test(printf-test) add_fmt_test(printf-test)
add_fmt_test(util-test mock-allocator.h) 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}) add_executable(macro-test macro-test.cc ${TEST_MAIN_SRC})
target_link_libraries(macro-test gmock cppformat) target_link_libraries(macro-test gmock cppformat)