Qt5 + cmake = SLOW moc.exe
I'am experiencing some abysmal compilation time when it comes to building a relatively small Qt5 app in windows.
The problem resembles alot the reported here issue : http://lists.qt-project.org/pipermail/interest/2015-January/014812.html
In case one uses cmake+qt5 to build on windows and have additional projects (in my case VTK/ITK/Boost)
moc.exe will go first over all visible to cmake paths, some windows ones, then finally in C:/Qt to find its headers.
So for generating one cpp file from moc.exe I end up with a few million IO operations! ine can use procmon.exe to inspect moc.exe on windows.
Rebuilding from scratch takes ages compared to what takes <5min before switching to Qt :((((
MOC cannot go in parallel (pre-processor!!!)
at that point I'm faced with a few options to explore, however I expect something of official HOW-TO on cmake+qt integration.
It might be a Qt5 or/and Cmake issue, hard to tell, since I'm not expert in either.
Can someone with more inside take a look please !?
How many includes do you have in your header files ? Are some of them module includes like e.g.
one possible refactoring you could do to make your compilation fast is use forward declaration in all possible places.
What does your CMakeLists look like?
I haven't experienced that sort of behaviour with Windows and Qt5.
I think I nailed it. It has to do with auto_moc(on) in cmake as well as the fact I do introduced big ass projects (ITk&VTK&BOOST) on board.
Also I tried linux with gnu-makefiles and moc runs fast. So it is also specific to VS.
Having one monolithic application (single cmake target) does not help either.
I did split the project in a few static libs and it seems better already, though a clean rebuild still takes forever :(
So the only solutions I can think of:
Disable auto moc and do manual moc in cmake. People have reported some auto_moc problems before.
Switch to dev in Linux. Right now it takes equal time to build all my dependencies and the project to just building the project under win :D
Note: Not a Qt issue. I posted here cause my initial feeling was it was occurring only in Qt5 (Qt4 is affected too however). So might escalate on cmake mailing lists.