View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012533CMakeCMakepublic2011-10-21 22:072011-10-22 14:31
ReporterJason Haslam 
Assigned ToAlex Neundorf 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMac OS X LionOSOS Version
Product VersionCMake 2.8.6 
Target VersionFixed in Version 
Summary0012533: AUTOMOC property doesn't moc header when the source file #includes *.moc
DescriptionGiven the following:

A.h:
class A {
  Q_OBJECT
}

A.cpp:
#include "A.h"
class B {
  Q_OBJECT
}
...
#include "A.moc"

The new AUTOMOC property correctly generates A.moc for class B defined in the source file, but fails to generate moc_A.cpp (and #include it in target_automoc.cpp) for class A defined in the header. I can force moc to run on the header by #including moc_A.cpp as well. IMHO the header should be scanned for classes containing Q_OBJECT even if the source file #includes *.moc.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0027618)
Alex Neundorf (developer)
2011-10-22 12:07

I see.
It only automatically scans the header file if it has found neither a *.moc nor a moc_*.cpp include.
(0027619)
Alex Neundorf (developer)
2011-10-22 12:10

Does adding the A.h to the list of source files for the target also make it work for you ?
(without inserting an #include "moc_A.cpp" into A.cpp)

Alex
(0027620)
Alex Neundorf (developer)
2011-10-22 13:47

This should be working now in the AutomocFindQ_OBJECTAlwaysInHeader branch on cmake stage, and I also already merged it into cmake next.
I also extended the automoc test to test for this case.
(0027621)
Jason Haslam (reporter)
2011-10-22 14:07

Yes, adding the header file to the list of source files works. That's a better workaround. Thanks for addressing this so quickly!
(0027622)
Jason Haslam (reporter)
2011-10-22 14:11

Ugh, didn't really mean to reopen this bug. I just wanted to add a note. I guess I'm not allowed to close it now. Sorry about that.
(0027624)
Alex Neundorf (developer)
2011-10-22 14:31

Yes, adding notes is only possible after reopening.
No problem.

Alex


 Issue History
Date Modified Username Field Change
2011-10-21 22:07 Jason Haslam New Issue
2011-10-22 11:08 Alex Neundorf Assigned To => Alex Neundorf
2011-10-22 11:08 Alex Neundorf Status new => assigned
2011-10-22 12:07 Alex Neundorf Note Added: 0027618
2011-10-22 12:10 Alex Neundorf Note Added: 0027619
2011-10-22 13:47 Alex Neundorf Note Added: 0027620
2011-10-22 13:47 Alex Neundorf Status assigned => closed
2011-10-22 13:47 Alex Neundorf Resolution open => fixed
2011-10-22 14:07 Jason Haslam Note Added: 0027621
2011-10-22 14:07 Jason Haslam Status closed => feedback
2011-10-22 14:07 Jason Haslam Resolution fixed => reopened
2011-10-22 14:11 Jason Haslam Note Added: 0027622
2011-10-22 14:11 Jason Haslam Status feedback => assigned
2011-10-22 14:31 Alex Neundorf Note Added: 0027624
2011-10-22 14:31 Alex Neundorf Status assigned => closed
2011-10-22 14:31 Alex Neundorf Resolution reopened => fixed


Copyright © 2000 - 2018 MantisBT Team