Reputation: 2759
I'm porting a Qt project to CMake and after adding set(CMAKE_AUTOUIC ON)
I've started experiencing a bunch of compilation problems, which are triggered when trying to compile mocs_compilation.cpp
, such as error C2504: 'Lucene::Reader': base class undefined
.
After looking into mocs_compilation.cpp
, I've found that the file is nothing more than a long list of #include
statements bundling source files into a huge translation unit.
CMake's documention mentions the following about mocs_compilation.cpp
;
(...)
Not included moc_.cpp files will be generated in custom folders to avoid name collisions and included in a separate <AUTOGEN_BUILD_DIR>/mocs_compilation.cpp file which is compiled into the target.
(...)
With this in mind, how does AUTOMOC determine which files go into mocs_compilation.cpp
? And is there any way to keep source files out of mocs_compilation.cpp
and build them separately?
Upvotes: 1
Views: 1124