Chapter 4.1 : The runExample function

The runExample function has to :
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)