Visual Studio is handled as a special case for autogen depends. However, the special handling works only for target dependencies, not file dependencies output by a custom command. Use a PRE_BUILD step only if all depends are targets.
Test this by generating files with a custom target, which moc requires to be present when it is run.