Fix automoc in some set ups
Qt is relying on whoever calls moc to include a file with the predefined values that will be used by the compiler, otherwise moc takes wrong paths and weird things happen. Instead, generate an include file and feed it to all mocs to make sure it's generating correct code.
Fixes: #16640 (closed)
Topic-rename: autogen-fixes