Why CMake add_custom_command with DEPFILE reruns every time?

The format is explained here, under DEPFILE option.

Space is OK as separator. But are you sure that all files specified as dependencies exist? Moreover, the depfile is transformed by CMake before to be consumed by ninja. Can you check the effective file used by ninja? This file is under <build-dir>/CMakeFiles/d directory.