Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

automoc in cmake missed creating a required moc file



  • I am building meshlab with cmake and it relies on Qt, so I need to use automoc.
    In the meshlab directory the implementation of a class (MainWindow) is split between two .cpp files, mainwindow_Init.cpp and mainwindow_Runtime.cpp, but they share the header file mainwindow.h. Initially when creating my add_executable command to my CMakeLists.txt file, I only included .cpp files. automoc was not creating the required moc_mainwindow.cpp.

    The solution was to add mainwindow.h to the list of files in the add_executable command.

    Including this here, because it took various searches and a bit of insight to figure this out, so maybe someone else will get there sooner!


Log in to reply