Can a CMake target name ever be an actual file?

I teethed on Makefiles, where by default a target name is an actual file (although you can have a .PHONY target that is independent of any like-named file).

I’m writing a custom CMake function which processes some input files to create an output file, and have been getting tangled on what the invoking target name should be. The obvious answer is that the target name should be the file to be created, but I can’t get it to work. Now I’m wondering if I’m hitting a CMake requirement that a target name must NOT be an actual file.

So: can CMake targets ever be actual files? Or, must target names and files be independent?

Target names are usually single path components. I suspect things are getting tripped up on any / in the target name (as it is meaningful to some generators and not all of them have a consistent working directory when the name gets used (namely Makefiles and it probably looks weird in IDEs too). I usually use - for separators in target names. As long as the OUTPUT is a real file, you should be fine.