FMT_EXTRA_TESTS -> FMT_PEDANTIC and use it to control extra warnings

This commit is contained in:
vitaut 2015-05-12 07:35:29 -07:00
parent 5517c8962e
commit a5757c86df
5 changed files with 10 additions and 10 deletions

View File

@ -12,7 +12,7 @@ env:
- BUILD_TYPE=Release
script:
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DFMT_EXTRA_TESTS=ON .
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DFMT_PEDANTIC=ON .
- make -j4
- CTEST_OUTPUT_ON_FAILURE=1 make test

View File

@ -10,7 +10,7 @@ if (NOT CMAKE_BUILD_TYPE)
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
endif ()
option(FMT_EXTRA_TESTS "Enable extra tests." OFF)
option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
project(FORMAT)
@ -90,16 +90,16 @@ if (BIICODE)
endif ()
add_library(format ${FMT_SOURCES})
if (CMAKE_COMPILER_IS_GNUCXX)
if (FMT_PEDANTIC AND CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(format PROPERTIES COMPILE_FLAGS
"-Wall -Wextra -Wshadow -pedantic")
endif ()
# If FMT_EXTRA_TESTS is TRUE, then test compilation with both -std=c++11
# If FMT_PEDANTIC is TRUE, then test compilation with both -std=c++11
# and the default flags. Otherwise use only the default flags.
# The library is distributed in the source form and users have full control
# over compile options, so the options used here only matter for testing.
if (CPP11_FLAG AND FMT_EXTRA_TESTS)
if (CPP11_FLAG AND FMT_PEDANTIC)
set_target_properties(format PROPERTIES COMPILE_FLAGS ${CPP11_FLAG})
# Test compilation with default flags.
file(GLOB src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*.cc test/*.h)

View File

@ -6,7 +6,7 @@ from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIG']
cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + config]
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config]
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_command = ['mingw32-make', '-j4']

View File

@ -13,6 +13,6 @@ endif ()
if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${BII_BLOCK_TARGET} INTERFACE -Wall -Wextra -Wshadow -pedantic)
endif ()
if (CPP11_FLAG AND FMT_EXTRA_TESTS)
if (CPP11_FLAG AND FMT_PEDANTIC)
target_compile_options(${BII_BLOCK_TARGET} INTERFACE ${CPP11_FLAG})
endif ()

View File

@ -24,14 +24,14 @@ endif ()
add_fmt_test(gtest-extra-test)
add_fmt_test(format-test)
if (FMT_EXTRA_TESTS AND MSVC)
if (FMT_PEDANTIC 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)
if (CMAKE_COMPILER_IS_GNUCXX)
if (FMT_PEDANTIC AND CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS
"-Wall -Wextra -pedantic -Wno-long-long -Wno-variadic-macros")
endif ()
@ -82,7 +82,7 @@ if (HAVE_FNO_EXCEPTIONS_FLAG)
PROPERTIES COMPILE_FLAGS -fno-exceptions)
endif ()
if (FMT_EXTRA_TESTS)
if (FMT_PEDANTIC)
add_test(compile-test ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMAKE_CURRENT_SOURCE_DIR}/compile-test"