CMake's add_custom_target is considered to be *always* out of date.
This patch changes it to a combination of add_custom_target and add_custom_command which actually tracks dependencies' timestamps.
On my machine this reliably saves 6-7 seconds on each test group.
This can be a large difference when debugging small tests.