Race condition when multi add_custom_target deps on same file generated by add_custom_command

The current CMake documentation also says

Do not list the output in more than one independent target that may build in parallel or the two instances of the rule may conflict (instead use the add_custom_target() command to drive the command and make the other targets depend on that one).

So adding a custom target seems to be the way.