1if(NOT OUTPUT OR NOT COMPARE OR NOT COMMAND) 2 message(FATAL_ERROR "Run and compare arguments missing") 3endif() 4 5if(INPUT) 6 # Run command with stdin input and redirect stdout to output 7 execute_process(COMMAND ${CMAKE_COMMAND} 8 "-DCOMMAND=${COMMAND}" 9 -DINPUT=${INPUT} 10 -DOUTPUT=${OUTPUT} 11 "-DSUCCESS_EXIT=${SUCCESS_EXIT}" 12 -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 13else() 14 # Run command and redirect stdout to output 15 execute_process(COMMAND ${CMAKE_COMMAND} 16 "-DCOMMAND=${COMMAND}" 17 -DOUTPUT=${OUTPUT} 18 "-DSUCCESS_EXIT=${SUCCESS_EXIT}" 19 -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) 20endif() 21 22# Compare that output is equal to specified file 23execute_process(COMMAND ${CMAKE_COMMAND} 24 -E compare_files ${COMPARE} ${OUTPUT})