[Development] RFC: CMake's automoc option to warn about missing moc includes; or not have mocs_compilation.cpp
Friedrich W. H. Kossebau
kossebau at kde.org
Mon Aug 14 18:58:56 CEST 2023
Hi,
Am Donnerstag, 13. Juli 2023, 23:16:07 CEST schrieb Friedrich W. H. Kossebau:
> I would like to propose some new features to CMake's automoc, around
> enforcing explicit moc includes, and to do this with support of the
> respective Qt developers, so first hear their comments or, best, get them
> also involved :)
>
> A)
> Have automoc emit warnings if no explicit moc include has been found and
> instead one is to be added to mocs_compilation.cpp (silently currently).
> Perhaps controlled by some target property AUTOMOC_MISSING_INCLUDE_WARNINGS,
> default OFF
> --- 8< ---
> AutoMoc warning: SRC:/foo.h contains a Q_OBJECT macro, but no file includes
> the moc file "moc_foo.cpp". Added to the target's mocs_compilation.cpp
> instead.
> --- 8< ---
>
> B)
> Have an option for no mocs_compilation.cpp at all being used in the build,
> saving the related build resources and failing hard in case of missing
> includes. Perhaps by a target property named AUTOMOC_USE_MOCS_COMPILATION,
> default ON.
Thanks once more those you who replied on- & off-list, seems the ideas have
been not that wild.
So finally got around and filed the ideas as requests on the CMake issue
tracker:
* Request: option to have automoc warn about non-explicit moc includes
https://gitlab.kitware.com/cmake/cmake/-/issues/25185
* Request: option to have automoc not add a mocs_compilation.cpp file
https://gitlab.kitware.com/cmake/cmake/-/issues/25186
Be invited to please add further input there and perhaps collaborate with the
CMake developers on this if you are an active stake holder on the matter.
Myself for now have no further spare resources here, just could plant the idea
seed :)
Cheers
Friedrich
More information about the Development
mailing list