Source doesn't exist yet for target depending on custom target using source generated by add_custom_command

Scope visibility between add_custom_command and targets can be a bit weird. I’d recommend moving the add_custom_command calls to be beside the target (not made by add_custom_target) that will use them.

This discussion has some relevant details for that.