2017-02-12 11:46:54 +00:00
|
|
|
add_library(catch_main OBJECT
|
|
|
|
"src/unit.cpp"
|
|
|
|
)
|
|
|
|
set_target_properties(catch_main PROPERTIES
|
|
|
|
CXX_STANDARD 11
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
)
|
|
|
|
target_include_directories(catch_main PRIVATE "thirdparty/catch")
|
|
|
|
|
2016-05-11 00:25:54 +00:00
|
|
|
# The unit test executable.
|
2016-05-18 09:25:36 +00:00
|
|
|
set(JSON_UNITTEST_TARGET_NAME "json_unit")
|
|
|
|
add_executable(${JSON_UNITTEST_TARGET_NAME}
|
2017-02-12 11:46:54 +00:00
|
|
|
$<TARGET_OBJECTS:catch_main>
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-algorithms.cpp"
|
|
|
|
"src/unit-allocator.cpp"
|
|
|
|
"src/unit-capacity.cpp"
|
2016-11-26 23:09:24 +00:00
|
|
|
"src/unit-cbor.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-class_const_iterator.cpp"
|
|
|
|
"src/unit-class_iterator.cpp"
|
|
|
|
"src/unit-class_lexer.cpp"
|
|
|
|
"src/unit-class_parser.cpp"
|
|
|
|
"src/unit-comparison.cpp"
|
|
|
|
"src/unit-concepts.cpp"
|
2016-08-04 20:51:08 +00:00
|
|
|
"src/unit-constructor1.cpp"
|
|
|
|
"src/unit-constructor2.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-convenience.cpp"
|
|
|
|
"src/unit-conversions.cpp"
|
|
|
|
"src/unit-deserialization.cpp"
|
2016-08-04 20:51:08 +00:00
|
|
|
"src/unit-element_access1.cpp"
|
|
|
|
"src/unit-element_access2.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-inspection.cpp"
|
|
|
|
"src/unit-iterator_wrapper.cpp"
|
2016-08-04 20:51:08 +00:00
|
|
|
"src/unit-iterators1.cpp"
|
|
|
|
"src/unit-iterators2.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-json_patch.cpp"
|
|
|
|
"src/unit-json_pointer.cpp"
|
2017-01-12 20:35:27 +00:00
|
|
|
"src/unit-meta.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-modifiers.cpp"
|
2016-11-11 16:11:13 +00:00
|
|
|
"src/unit-msgpack.cpp"
|
2017-01-14 01:20:53 +00:00
|
|
|
"src/unit-noexcept.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-pointer_access.cpp"
|
|
|
|
"src/unit-readme.cpp"
|
|
|
|
"src/unit-reference_access.cpp"
|
|
|
|
"src/unit-regression.cpp"
|
|
|
|
"src/unit-serialization.cpp"
|
|
|
|
"src/unit-testsuites.cpp"
|
2016-11-08 12:17:16 +00:00
|
|
|
"src/unit-udt.cpp"
|
2016-08-04 19:55:47 +00:00
|
|
|
"src/unit-unicode.cpp"
|
2016-05-11 00:25:54 +00:00
|
|
|
)
|
|
|
|
|
2016-05-18 09:25:36 +00:00
|
|
|
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
|
2016-05-11 00:25:54 +00:00
|
|
|
CXX_STANDARD 11
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
)
|
|
|
|
|
2017-02-12 11:46:54 +00:00
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
|
|
|
|
COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS"
|
|
|
|
COMPILE_OPTIONS "/EHsc;$<$<CONFIG:Release>:/Od>"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-12-22 08:35:53 +00:00
|
|
|
target_include_directories(${JSON_UNITTEST_TARGET_NAME} PRIVATE "src" "thirdparty/catch")
|
2016-05-18 09:25:36 +00:00
|
|
|
target_link_libraries(${JSON_UNITTEST_TARGET_NAME} ${JSON_TARGET_NAME})
|
2016-05-11 00:38:52 +00:00
|
|
|
|
2017-02-12 11:46:54 +00:00
|
|
|
include(cotire OPTIONAL)
|
|
|
|
|
|
|
|
if(COMMAND cotire)
|
|
|
|
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
|
|
|
|
COTIRE_ADD_UNITY_BUILD FALSE
|
|
|
|
COTIRE_CXX_PREFIX_HEADER_INIT "src/prefix.hpp"
|
|
|
|
)
|
|
|
|
# HACK - CMAKE_INCLUDE_SYSTEM_FLAG_CXX has a trailing space, which Cotire doesn't strip
|
|
|
|
# Technically, this fix should go in cotire.cmake. TODO - submit a pull request upstream.
|
|
|
|
if (CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
|
|
|
|
string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}" CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
|
|
|
|
endif()
|
|
|
|
cotire(${JSON_UNITTEST_TARGET_NAME})
|
|
|
|
endif()
|
|
|
|
|
2016-05-18 09:25:36 +00:00
|
|
|
add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_default"
|
|
|
|
COMMAND ${JSON_UNITTEST_TARGET_NAME}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_all"
|
2016-11-16 21:49:25 +00:00
|
|
|
COMMAND ${JSON_UNITTEST_TARGET_NAME} "*"
|
2016-05-18 09:25:36 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|