mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
FMT_EXTRA_TESTS -> FMT_PEDANTIC and use it to control extra warnings
This commit is contained in:
parent
5517c8962e
commit
a5757c86df
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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']
|
||||
|
@ -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 ()
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user