build and test in c++11 and in c++98 mode

This commit is contained in:
Mario Werner
2016-02-07 18:23:02 +01:00
parent 8c8877df5a
commit 6a79a3279b
6 changed files with 69 additions and 19 deletions
+3 -13
View File
@@ -10,7 +10,9 @@ add_library(gmock STATIC
${FMT_GMOCK_DIR}/gmock-gtest-all.cc ${FMT_GMOCK_DIR}/gmock/gmock.h
${FMT_GMOCK_DIR}/gtest/gtest.h ${FMT_GMOCK_DIR}/gtest/gtest-spi.h)
target_include_directories(gmock PUBLIC ${FMT_GMOCK_DIR})
target_compile_options(gmock PUBLIC ${CPP11_FLAG})
if (FMT_USE_CPP11)
target_compile_options(gmock PUBLIC ${CPP11_FLAG})
endif ()
find_package(Threads)
if (Threads_FOUND)
@@ -112,18 +114,6 @@ if (HAVE_FNO_EXCEPTIONS_FLAG)
endif ()
if (FMT_PEDANTIC)
# syntax test which checks if the library builds in gnu++98 mode
file(GLOB test_src *.cc *.h)
file(GLOB lib_src ../cppformat/*.cc ../cppformat/*.h)
add_library(testformat STATIC ${test_src} ${lib_src})
target_include_directories(testformat PRIVATE .. ../gmock)
target_compile_definitions(testformat PRIVATE
FMT_USE_FILE_DESCRIPTORS=$<BOOL:${HAVE_OPEN}>)
check_cxx_compiler_flag(-std=gnu++98 HAVE_STD_GNUPP98_FLAG)
if (HAVE_STD_GNUPP98_FLAG)
target_compile_options(testformat PRIVATE -std=gnu++98)
endif ()
# Test that the library compiles without windows.h.
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_library(no-windows-h-test ../cppformat/format.cc)