Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.7.0 Beta3
-
c07a47cbf (dev), 9932a2f64 (6.7)
Description
As a developer of Qt, I get an annoying qtversionnumber.h: No relevant classes found. No output generated. warning from moc when building Qt. Removing the Q_OBJECT-in-comment there makes it go away.
It seems CMake/automoc doesn't understand that the Q_OBJECT appears in a multi-line C-style comment. This might be a CMake bug.
Tried to add the usual qmake ignore Q_OBJECT there, but a) it isn't recognized in a C++ comment (//), only in a C-style (/**/) one, and b) trying to close and re-open the C-style comment also doesn't make it recognize it, at least not like this:
{*/ /* qmake ignore Q_OBJECT */ /* Q_OBJECT
{*/ /* qmake ignore Q_OBJECT */ /* Q_OBJECT
There are two solutions I can see, both require changes to automoc:
- Fix the parser to understand multi-line C comments and automatically ignore contained keywords (except in conjunction with qmake ignore)
- Allow qmake ignore also in C++ comments
For now, I'll suppress the warning by removing the Q_OBJECT macro from the header, but leave this ticket open for the more fundamental fix.
Note: attached minimal program demonstrates that this is an automoc problem. QMake gets this right (build with both to see difference).