file(GENERATE) reads and writes relative to CMAKE_BINARY_DIR
When a relative path is given for the `OUTPUT` of `file(GENERATE)`, the path is interpreted as being relative to `CMAKE_BINARY_DIR`. This seems inconsistent with most other CMake commands which are generally interpreted as being relative to `CMAKE_CURRENT_BINARY_DIR`. Similarly, a relative path for `INPUT` also seems to be interpreted as being relative to `CMAKE_SOURCE_DIR` rather than `CMAKE_CURRENT_SOURCE_DIR`. Presumably, this is a consequence of the file writing being delayed to the generation phase rather than being performed immediately at the point of the call during the configure phase, but the difference in behaviour compared to most other commands makes this unexpected. The docs make no mention of the different relative path behaviour either, so I'm wondering if this is deliberate and simply omitted from the docs or whether it is indeed a bug in the `file(GENERATE)` behaviour.
issue