From 60405cf693cb0dec951cb1d411e252bb783526ea Mon Sep 17 00:00:00 2001 From: vitaut Date: Sat, 28 Mar 2015 17:29:12 -0700 Subject: [PATCH] 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. --- CMakeLists.txt | 2 -- test/CMakeLists.txt | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63b6baef..c51acd63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,8 +83,6 @@ add_library(format ${FMT_SOURCES}) if (CMAKE_COMPILER_IS_GNUCXX) set_target_properties(format PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wshadow -pedantic") -elseif (MSVC) - set_target_properties(format PROPERTIES COMPILE_FLAGS /W4) endif () # If FMT_EXTRA_TESTS is TRUE, then test compilation with both -std=c++11 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 210f3abd..ce2becae 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,6 +24,10 @@ endif () add_fmt_test(gtest-extra-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(printf-test) foreach (target format-test printf-test)