`CMAKE_AUTOMOC` creates `_autogen` targets for targets which do not need it
CMAKE_AUTOMOC is provided for convenience to avoid the need to set the
AUTOMOC property on all/most targets. Similar for the other Qt generator features.
_autogen targets for every target with the
AUTOMOC property set. In projects with a mix of Qt-dependent and non-Qt-dependent targets, this means that setting
CMAKE_AUTOMOC ON clutters up IDEs with nearly-empty "moc_compilations.cpp" files, and creates extra steps in Ninja projects which do almost nothing (and which do nothing useful).
IIRC, CMake searches for
Q_OBJECT etc at build time or at CMake time, so it does not know that a target source files does not use the macros and does not need to have a corresponding
However, CMake does know whether a target depends transitively on
Qt4::QtCore etc targets. Some projects still use variables instead of imported targets, but a setting or policy could be introduced which would cause CMake to exclude the
_autogen targets for targets which do not depend on Qt imported targets.