Teach the add_custom_command and add_custom_target commands a new USES_TERMINAL option. Use it to tell the generator to give the command direct access to the terminal if possible.
Add RunCMake.add_custom_command and RunCMake.add_custom_target tests to cover the error messages for these commands.