2014-11-04 00:36:24 +02:00
|
|
|
set(UNITTEST_SOURCES
|
2015-04-14 10:19:05 +08:00
|
|
|
allocatorstest.cpp
|
2015-02-11 12:50:36 +02:00
|
|
|
bigintegertest.cpp
|
2014-11-04 00:36:24 +02:00
|
|
|
documenttest.cpp
|
2016-02-11 16:08:17 +08:00
|
|
|
dtoatest.cpp
|
2014-11-04 00:36:24 +02:00
|
|
|
encodedstreamtest.cpp
|
|
|
|
encodingstest.cpp
|
2016-02-02 18:20:36 +08:00
|
|
|
fwdtest.cpp
|
2014-11-04 00:36:24 +02:00
|
|
|
filestreamtest.cpp
|
2015-04-13 15:11:32 +08:00
|
|
|
itoatest.cpp
|
2016-02-07 22:15:17 +08:00
|
|
|
istreamwrappertest.cpp
|
2014-11-04 00:36:24 +02:00
|
|
|
jsoncheckertest.cpp
|
2015-02-11 12:50:36 +02:00
|
|
|
namespacetest.cpp
|
2015-04-10 14:54:13 +08:00
|
|
|
pointertest.cpp
|
2015-04-13 10:58:05 +08:00
|
|
|
prettywritertest.cpp
|
2016-02-07 23:30:51 +08:00
|
|
|
ostreamwrappertest.cpp
|
2014-11-04 00:36:24 +02:00
|
|
|
readertest.cpp
|
2015-05-24 21:23:39 +08:00
|
|
|
regextest.cpp
|
2015-05-01 17:59:31 +08:00
|
|
|
schematest.cpp
|
2015-04-15 18:18:49 +08:00
|
|
|
simdtest.cpp
|
2015-05-07 17:09:55 +08:00
|
|
|
strfunctest.cpp
|
2015-02-11 12:50:36 +02:00
|
|
|
stringbuffertest.cpp
|
|
|
|
strtodtest.cpp
|
2014-11-04 00:36:24 +02:00
|
|
|
unittest.cpp
|
|
|
|
valuetest.cpp
|
|
|
|
writertest.cpp)
|
|
|
|
|
2016-01-04 09:27:53 +08:00
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
if(CCACHE_FOUND)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics")
|
|
|
|
endif()
|
|
|
|
endif(CCACHE_FOUND)
|
|
|
|
|
2015-02-11 14:10:09 +02:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2015-05-05 10:28:26 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal")
|
2015-02-11 14:10:09 +02:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2015-12-18 18:34:04 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
|
2015-02-11 14:10:09 +02:00
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
2015-02-19 22:41:31 +02:00
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
|
2015-02-11 14:10:09 +02:00
|
|
|
endif()
|
|
|
|
|
2015-05-03 18:55:55 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRAPIDJSON_HAS_STDSTRING=1")
|
|
|
|
|
2014-11-12 01:57:00 +02:00
|
|
|
add_library(namespacetest STATIC namespacetest.cpp)
|
|
|
|
|
2014-11-04 00:36:24 +02:00
|
|
|
add_executable(unittest ${UNITTEST_SOURCES})
|
2014-11-12 01:57:00 +02:00
|
|
|
target_link_libraries(unittest ${TEST_LIBRARIES} namespacetest)
|
2014-11-11 17:50:32 +02:00
|
|
|
|
|
|
|
add_dependencies(tests unittest)
|
|
|
|
|
2014-11-04 00:36:24 +02:00
|
|
|
add_test(NAME unittest
|
2014-11-11 17:16:51 +02:00
|
|
|
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest
|
2014-11-04 00:36:24 +02:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
2014-11-12 01:57:00 +02:00
|
|
|
|
2015-02-17 11:14:47 +01:00
|
|
|
if(NOT MSVC)
|
2015-04-15 18:18:49 +08:00
|
|
|
# Not running SIMD.* unit test cases for Valgrind
|
2015-02-17 11:14:47 +01:00
|
|
|
add_test(NAME valgrind_unittest
|
2015-04-15 18:18:49 +08:00
|
|
|
COMMAND valgrind --leak-check=full --error-exitcode=1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest --gtest_filter=-SIMD.*
|
2015-02-17 11:14:47 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
add_test(NAME symbol_check
|
|
|
|
COMMAND sh -c "objdump -t -C libnamespacetest.a | grep rapidjson ; test $? -ne 0"
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2014-11-12 01:57:00 +02:00
|
|
|
|
2015-02-17 11:14:47 +01:00
|
|
|
endif(NOT MSVC)
|