Chapter 3.1 : The runExample function
The runExample function has to :- Create a target (run followed by the name of the program) to run the program (run_all).
- Add a dependency to the run_all to call all the custom commands.
1 2 3 4 5 6 7 8 9 10 |
function(runExample targetName) add_custom_command(OUTPUT ${OUTPUT_PERF_DIR}/${targetName}.txt COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${targetName} 2> ${OUTPUT_PERF_DIR}/${targetName}.txt WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMENT "Run ${targetName} program" DEPENDS ${targetName} ) add_custom_target("run_${targetName}" DEPENDS ${OUTPUT_PERF_DIR}/${targetName}.txt) add_dependencies(run_all "run_${targetName}") endfunction(runExample) |