1message("Run ${CMD} to produce: ${OUT} and compare with: ${DATA}")
2# run the test
3execute_process(COMMAND "${CMD}" OUTPUT_FILE "${OUT}" RESULT_VARIABLE ret)
4if(NOT ${ret} EQUAL 0)
5  message(FATAL_ERROR "${CMD} returned a non-zero value:${ret}")
6endif()
7# use cmake executable to compare the output of the tests
8execute_process(COMMAND "${CMAKE_COMMAND}" -E compare_files "${OUT}" "${DATA}"
9  RESULT_VARIABLE ret)
10if(NOT ${ret} EQUAL 0)
11  message(FATAL_ERROR
12    "compare_files ${OUT} ${DATA} returned a non-zero value:${ret}")
13endif()