File tree 2 files changed +16
-6
lines changed
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -167,9 +167,24 @@ if(ENABLE_CJSON_TEST)
167
167
add_executable ("${TEST_CJSON} " test .c)
168
168
target_link_libraries ("${TEST_CJSON} " "${CJSON_LIB} " )
169
169
170
+ add_test (NAME ${TEST_CJSON} COMMAND "${CMAKE_CURRENT_BINARY_DIR} /${TEST_CJSON} " )
171
+ # Disable -fsanitize=float-divide-by-zero for cJSON_test
172
+ list (FIND custom_compiler_flags "-fsanitize=float-divide-by-zero" float_divide_by_zero_found)
173
+ if (float_divide_by_zero_found)
174
+ target_compile_options (${TEST_CJSON} PRIVATE "-fno-sanitize=float-divide-by-zero" )
175
+ endif ()
176
+
170
177
if (ENABLE_CJSON_UTILS)
171
178
set (TEST_CJSON_UTILS cJSON_test_utils)
172
179
add_executable ("${TEST_CJSON_UTILS} " test_utils.c)
173
180
target_link_libraries ("${TEST_CJSON_UTILS} " "${CJSON_UTILS_LIB} " )
181
+
182
+ add_test (NAME ${TEST_CJSON_UTILS} COMMAND "${CMAKE_CURRENT_BINARY_DIR} /${TEST_CJSON_UTILS} " )
174
183
endif ()
184
+
185
+ #"check" target that automatically builds everything and runs the tests
186
+ add_custom_target (check
187
+ COMMAND ${CMAKE_CTEST_COMMAND} --output -on -failure
188
+ DEPENDS ${unity_tests} ${TEST_CJSON} ${TEST_CJSON_UTILS} )
189
+
175
190
endif ()
Original file line number Diff line number Diff line change @@ -46,17 +46,12 @@ if(ENABLE_CJSON_TEST)
46
46
endif ()
47
47
endif ()
48
48
49
- #"check" target that automatically builds everything and runs the tests
50
- add_custom_target (check
51
- COMMAND ${CMAKE_CTEST_COMMAND} --output -on -failure
52
- DEPENDS ${unity_tests} )
53
-
54
49
foreach (unity_test ${unity_tests} )
55
50
add_executable ("${unity_test} " "${unity_test} .c" )
56
51
target_link_libraries ("${unity_test} " "${CJSON_LIB} " unity test -common)
57
52
if (MEMORYCHECK_COMMAND)
58
53
add_test (NAME "${unity_test} "
59
- COMMAND "${MEMORYCHECK_COMMAND} " ${MEMORYCHECK_COMMAND_OPTIONS} ". /${unity_test} " )
54
+ COMMAND "${MEMORYCHECK_COMMAND} " ${MEMORYCHECK_COMMAND_OPTIONS} "${CMAKE_CURRENT_BINARY_DIR} /${unity_test} " )
60
55
else ()
61
56
add_test (NAME "${unity_test} "
62
57
COMMAND "./${unity_test} " )
You can’t perform that action at this time.
0 commit comments