@@ -185,65 +185,78 @@ if ( JSONLINT )
185
185
add_test ( NAME validate-test2
186
186
WORKING_DIRECTORY ${DATA_DIR}
187
187
COMMAND ${JSONLINT} test2.json )
188
+ set ( OPTIONAL_TESTS2 ${OPTIONAL_TESTS2} validate-test2 )
188
189
add_test ( NAME validate-test4
189
190
WORKING_DIRECTORY ${DATA_DIR}
190
191
COMMAND ${JSONLINT} test4.json )
192
+ set ( OPTIONAL_TESTS4 ${OPTIONAL_TESTS4} validate-test4 )
191
193
endif ( JSONLINT )
192
194
# Check output for differences
193
195
if ( DIFF )
194
196
add_test ( NAME test2-regression
195
197
WORKING_DIRECTORY ${DATA_DIR}
196
198
COMMAND ${DIFF} -q test2.json ${CMAKE_SOURCE_DIR} /files/test2.json )
199
+ set ( OPTIONAL_TESTS2 ${OPTIONAL_TESTS2} test2-regression )
197
200
add_test ( NAME test4-regression
198
201
WORKING_DIRECTORY ${DATA_DIR}
199
202
COMMAND ${DIFF} -q test4.json ${CMAKE_SOURCE_DIR} /files/test4.json )
203
+ set ( OPTIONAL_TESTS4 ${OPTIONAL_TESTS4} test4-regression )
200
204
else ( DIFF )
201
205
message ( WARNING
202
206
"For full test coverage diff, or a similar tool must be present on your system" )
203
207
endif ( DIFF )
204
- set_tests_properties ( validate-test2 test2-regression
205
- PROPERTIES
206
- DEPENDS test -${CMAKE_PROJECT_NAME}
207
- REQUIRED_FILES "${DATA_DIR} /test2.json"
208
- RESOURCE_LOCK "${DATA_DIR} /test2.json" )
209
- set_tests_properties ( validate-test4 test4-regression
210
- PROPERTIES
211
- DEPENDS test -${CMAKE_PROJECT_NAME}
212
- REQUIRED_FILES "${DATA_DIR} /test4.json"
213
- RESOURCE_LOCK "${DATA_DIR} /test4.json" )
214
-
208
+ if ( DIFF OR JSONLINT )
209
+ set_tests_properties ( ${OPTIONAL_TESTS2}
210
+ PROPERTIES
211
+ DEPENDS test -${CMAKE_PROJECT_NAME}
212
+ REQUIRED_FILES "${DATA_DIR} /test2.json"
213
+ RESOURCE_LOCK "${DATA_DIR} /test2.json" )
214
+ set_tests_properties ( ${OPTIONAL_TESTS4}
215
+ PROPERTIES
216
+ DEPENDS test -${CMAKE_PROJECT_NAME}
217
+ REQUIRED_FILES "${DATA_DIR} /test4.json"
218
+ RESOURCE_LOCK "${DATA_DIR} /test4.json" )
219
+ endif ( DIFF OR JSONLINT )
215
220
# Static lib
216
221
add_test ( NAME test -${CMAKE_PROJECT_NAME}-static
217
222
WORKING_DIRECTORY "${CMAKE_BINARY_DIR} /bin/"
218
223
COMMAND test -${CMAKE_PROJECT_NAME}-static )
224
+ unset ( OPTIONAL_TESTS2 )
225
+ unset ( OPTIONAL_TESTS4 )
219
226
# Validate output
220
227
if ( JSONLINT )
221
228
add_test ( NAME validate-test2-static
222
229
WORKING_DIRECTORY ${DATA_DIR}
223
230
COMMAND ${JSONLINT} test2.json )
231
+ set ( OPTIONAL_TESTS2 ${OPTIONAL_TESTS2} validate-test2-static )
224
232
add_test ( NAME validate-test4-static
225
233
WORKING_DIRECTORY ${DATA_DIR}
226
234
COMMAND ${JSONLINT} test4.json )
235
+ set ( OPTIONAL_TESTS4 ${OPTIONAL_TESTS4} validate-test4-static )
227
236
endif ( JSONLINT )
228
237
# Check output for differences
229
238
if ( DIFF )
230
239
add_test ( NAME test2-regression-static
231
240
WORKING_DIRECTORY ${DATA_DIR}
232
241
COMMAND ${DIFF} -q test2.json ${CMAKE_SOURCE_DIR} /files/test2.json )
242
+ set ( OPTIONAL_TESTS2 ${OPTIONAL_TESTS2} test2-regression-static )
233
243
add_test ( NAME test4-regression-static
234
244
WORKING_DIRECTORY ${DATA_DIR}
235
245
COMMAND ${DIFF} -q test4.json ${CMAKE_SOURCE_DIR} /files/test4.json )
246
+ set ( OPTIONAL_TESTS4 ${OPTIONAL_TESTS4} test4-regression-static )
236
247
endif ( DIFF )
237
- set_tests_properties ( validate-test2-static test2-regression-static
248
+ if ( JSONLINT OR DIFF )
249
+ set_tests_properties ( ${OPTIONAL_TESTS2}
238
250
PROPERTIES
239
251
DEPENDS test -${CMAKE_PROJECT_NAME}-static
240
252
REQUIRED_FILES "${DATA_DIR} /test2.json"
241
253
RESOURCE_LOCK "${DATA_DIR} /test2.json" )
242
- set_tests_properties ( validate-test4-static test4-regression-static
254
+ set_tests_properties ( ${OPTIONAL_TESTS4}
243
255
PROPERTIES
244
256
DEPENDS test -${CMAKE_PROJECT_NAME}-static
245
257
REQUIRED_FILES "${DATA_DIR} /test4.json"
246
258
RESOURCE_LOCK "${DATA_DIR} /test4.json" )
259
+ endif ( JSONLINT OR DIFF )
247
260
248
261
if ( JSONLINT )
249
262
set_tests_properties ( test -${CMAKE_PROJECT_NAME} test -${CMAKE_PROJECT_NAME}-static
0 commit comments