Use /W4 in format-test and only if FMT_EXTRA_TESTS is set

as (1) we don't want to force /W4 on users of the library and (2) some of
the warnings only show up when the formatting functions are used.
This commit is contained in:
vitaut 2015-03-28 17:29:12 -07:00
parent 9c75d0ccf7
commit 60405cf693
2 changed files with 4 additions and 2 deletions

View File

@ -83,8 +83,6 @@ add_library(format ${FMT_SOURCES})
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(format PROPERTIES COMPILE_FLAGS set_target_properties(format PROPERTIES COMPILE_FLAGS
"-Wall -Wextra -Wshadow -pedantic") "-Wall -Wextra -Wshadow -pedantic")
elseif (MSVC)
set_target_properties(format PROPERTIES COMPILE_FLAGS /W4)
endif () endif ()
# If FMT_EXTRA_TESTS is TRUE, then test compilation with both -std=c++11 # If FMT_EXTRA_TESTS is TRUE, then test compilation with both -std=c++11

View File

@ -24,6 +24,10 @@ endif ()
add_fmt_test(gtest-extra-test) add_fmt_test(gtest-extra-test)
add_fmt_test(format-test) add_fmt_test(format-test)
if (FMT_EXTRA_TESTS AND MSVC)
set_target_properties(format-test PROPERTIES COMPILE_FLAGS /W4)
endif ()
add_fmt_test(format-impl-test CUSTOM_LINK) add_fmt_test(format-impl-test CUSTOM_LINK)
add_fmt_test(printf-test) add_fmt_test(printf-test)
foreach (target format-test printf-test) foreach (target format-test printf-test)