1# vim: et ts=4 sts=4 sw=4 tw=0
2
3add_executable(jsoncpp_test
4    jsontest.cpp
5    jsontest.h
6    fuzz.cpp
7    fuzz.h
8    main.cpp
9)
10
11
12if(BUILD_SHARED_LIBS)
13    if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
14        add_compile_definitions( JSON_DLL )
15    else()
16        add_definitions( -DJSON_DLL )
17    endif()
18    target_link_libraries(jsoncpp_test jsoncpp_lib)
19else()
20    target_link_libraries(jsoncpp_test jsoncpp_static)
21endif()
22
23# another way to solve issue #90
24#set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store)
25
26## Create tests for dashboard submission, allows easy review of CI results https://my.cdash.org/index.php?project=jsoncpp
27add_test(NAME jsoncpp_test
28    COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>
29)
30set_target_properties(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
31
32# Run unit tests in post-build
33# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
34if(JSONCPP_WITH_POST_BUILD_UNITTEST)
35    add_custom_command(TARGET jsoncpp_test
36        POST_BUILD
37        COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:jsoncpp_test>
38    )
39endif()
40