ADD_DEPENDENCIES(prune_tests prune_tests_${_category})
ADD_CUSTOM_TARGET(regen_tests_${_category}
- COMMAND ${CMAKE_COMMAND}
+ COMMAND
+ test ! -f ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}/${_category} --target regenerate
COMMENT "Processing tests/${_category}"
)
ADD_DEPENDENCIES(regen_tests regen_tests_${_category})
ADD_CUSTOM_TARGET(clean_tests_${_category}
- COMMAND ${CMAKE_COMMAND}
+ COMMAND
+ test ! -f ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}/${_category} --target clean
COMMENT "Processing tests/${_category}"
)
# And a rule on how to build the example step:
ADD_CUSTOM_COMMAND(OUTPUT ${_step_dir}/build_output
- COMMAND [ ! -f ${_step_dir}/configure_output ]
+ COMMAND test ! -f ${_step_dir}/configure_output
|| (rm -f ${_step_dir}/failing_build_output
&&${CMAKE_COMMAND} --build ${_step_dir} --target all
> ${_step_dir}/build_output 2>&1)
&& echo "${_test}: BUILD failed. Output:"
&& cat ${_step_dir}/failing_build_output
&& exit 1)
- COMMAND [ -f ${_step_dir}/configure_output ]
+ COMMAND test -f ${_step_dir}/configure_output
|| (rm -f ${_step_dir}/build_output
&& rm -f ${_step_dir}/failing_build_output
&& echo "${_test}: BUILD stage not invoked due to failing CONFIGURE") # succeed anyway!
# And a rule on how to run the example step:
ADD_CUSTOM_COMMAND(OUTPUT ${_step_dir}/run_output
- COMMAND [ ! -f ${_step_dir}/build_output ]
+ COMMAND test ! -f ${_step_dir}/build_output
|| (rm -f ${_step_dir}/failing_run_output
&& ${CMAKE_COMMAND} --build ${_step_dir} --target run
> ${_step_dir}/run_output 2>&1)
&& echo "${_test}: RUN failed. Output:"
&& cat ${_step_dir}/failing_run_output
&& exit 1)
- COMMAND [ -f ${_step_dir}/build_output ]
+ COMMAND test -f ${_step_dir}/build_output
|| ( rm -f ${_step_dir}/run_output
&& rm -f ${_step_dir}/failing_run_output
&& echo "${_test}: RUN stage not invoked due to failing BUILD"