target_sources(FILE_SET) works on custom targets
cmake_minimum_required(VERSION 3.23)
project(test C)
add_custom_target(tgt ${CMAKE_COMMAND} -E true)
file(WRITE ${CMAKE_BINARY_DIR}/header.h "")
target_sources(tgt PRIVATE FILE_SET HEADERS FILES ${CMAKE_BINARY_DIR}/header.h)
The question is, should this be allowed?