target_sources does not work with a custom target.
You can write:
ADD_CUSTOM_TARGET( mytarget ALL SOURCES mysource )
However, you cannot write:
ADD_CUSTOM_TARGET( mytarget ALL) TARGET_SOURCES(mytarget PRIVATE mysource)
Doing so gives "target_sources called with non-compilable target type". This is a problem for us because I have sources with custom commands, but the main target has no output. I use a macro to add these rules and sources simultaneously (as well as a target-level dependency on another target), but that does not work properly for a custom target.