Fix target existence check.
Only gather source files for AUTOMOC and AUTOUIC.
Merge topic 'fix-Qt-autogen' into next

6ed3d686 Only gather source files for AUTOMOC and AUTOUIC.
5373bdf4 Fix target existence check.