3 ms·
This is a Qt development (i.e. the development of Qt, not with) blog so for their regular audience the reasons for moc existing are probably already well known.
by rryan 12y ago
This is a Qt development (i.e. the development of Qt, not with) blog so for their regular audience the reasons for moc existing are probably already well known.
It would be great if we could ditch moc. If you're using Qt without qmake it can be pain in the butt.
- ehvatum 12y agoCMake has robust moc and Qt build support in general. I have put it through some interesting use cases without issue. For a simple GUI program, in your CMakeLists.txt, you'd typically want something like: set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Gui REQUIRED) find_package(Qt5Widgets REQUIRED) qt5_wrap_ui(UI_HEADERS dialog1.ui dialog2.ui mainwindow.ui) qt5_add_resources(UI_RESOURCES resources.qrc) add_executable(simple_program main.cpp dialog1.cpp dialog2.cpp ${UI_HEADERS} ${UI_RESOURCES}) target_link_libraries(simple_program Qt5::Core Qt5::Gui Qt5::Widgets) Additionally, CMake is the best way I have found to build PyQt5 Python extensions that have C++ Qt bits exposed via PyQt/SIP. A project (of mine) that does this: https://github.com/erikhvatum/RisWidget https://github.com/erikhvatum/RisWidget (MIT license, so feel free to copy and paste anything useful).