diff --git a/.travis.yml b/.travis.yml index a039e2ef..3260ce46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 348b302d..0f31aaee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/support/appveyor-build.py b/support/appveyor-build.py index 7aa61d78..2fbb545c 100755 --- a/support/appveyor-build.py +++ b/support/appveyor-build.py @@ -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'] diff --git a/support/cmake/biicode.cmake b/support/cmake/biicode.cmake index 02d6ee24..a1feaf13 100644 --- a/support/cmake/biicode.cmake +++ b/support/cmake/biicode.cmake @@ -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 () diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 85b85f1b..f7001924 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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"