This is touching on the general idea of domain-specific languages that produce C sources or headers. Lexer and parser generators like flex and bison are other examples. We do not currently have a first-class way to model that, so we typically go with the add_custom_command
/add_custom_target
approach.
I suggest using the custom command/target approach for ISPC for now. The custom commands can even be part of regular C or C++ targets because we already support generated header files in custom commands where the headers are then used to compile the C or C++ sources.
The headers generated by ISPC do not need to be explicitly considered private or public and do not need to be implicitly added to the PUBLIC_HEADER
or PRIVATE_HEADER
target properties at all. We don’t do that for normal C headers either. Projects can specify those explicitly or handle installation themselves via install(FILES)
.