2015-03-06 04:57:41 +08:00
|
|
|
# vim: et ts=4 sts=4 sw=4 tw=0
|
2013-05-09 04:21:11 +08:00
|
|
|
|
2019-01-13 02:32:15 +08:00
|
|
|
add_executable( jsoncpp_test
|
2013-05-09 04:21:11 +08:00
|
|
|
jsontest.cpp
|
2013-05-09 23:21:06 +08:00
|
|
|
jsontest.h
|
2013-05-09 04:21:11 +08:00
|
|
|
main.cpp
|
|
|
|
)
|
|
|
|
|
2015-01-28 04:01:42 +08:00
|
|
|
|
2018-12-12 23:40:05 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
add_definitions( -DJSON_DLL )
|
|
|
|
endif()
|
|
|
|
target_link_libraries(jsoncpp_test jsoncpp_lib)
|
2013-05-09 04:21:11 +08:00
|
|
|
|
2015-01-25 04:34:54 +08:00
|
|
|
# another way to solve issue #90
|
|
|
|
#set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store)
|
|
|
|
|
2013-05-09 04:21:11 +08:00
|
|
|
# Run unit tests in post-build
|
|
|
|
# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
|
2018-12-12 23:40:05 +08:00
|
|
|
if(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
|
|
|
if(BUILD_SHARED_LIBS)
|
2015-03-06 04:57:41 +08:00
|
|
|
# First, copy the shared lib, for Microsoft.
|
|
|
|
# Then, run the test executable.
|
2018-12-12 23:40:05 +08:00
|
|
|
add_custom_command( TARGET jsoncpp_test
|
2015-03-06 04:57:41 +08:00
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:jsoncpp_lib> $<TARGET_FILE_DIR:jsoncpp_test>
|
2018-10-03 15:18:16 +08:00
|
|
|
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>)
|
2018-12-12 23:40:05 +08:00
|
|
|
else(BUILD_SHARED_LIBS)
|
2015-03-06 04:57:41 +08:00
|
|
|
# Just run the test executable.
|
2018-12-12 23:40:05 +08:00
|
|
|
add_custom_command( TARGET jsoncpp_test
|
2015-03-06 04:57:41 +08:00
|
|
|
POST_BUILD
|
2018-10-03 15:18:16 +08:00
|
|
|
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>)
|
2018-12-12 23:40:05 +08:00
|
|
|
endif()
|
2019-01-13 02:32:15 +08:00
|
|
|
## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp
|
|
|
|
add_test(NAME jsoncpp_test
|
|
|
|
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>
|
|
|
|
)
|
2018-12-12 23:40:05 +08:00
|
|
|
endif()
|
2013-05-09 04:21:11 +08:00
|
|
|
|
2019-01-13 02:32:15 +08:00
|
|
|
set_target_properties(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
|