Qt moc error using CMake

后端 未结 1 636
一向
一向 2021-01-26 08:23

I am trying to write an OpenCV application creating the GUI with Qt and generating the makefiles using CMake. The problem that I have is that when I try to execute the mak

相关标签:
1条回答
  • 2021-01-26 08:35

    Config for Qt5:

    set(QT_VERSION_REQ "5.2")
    find_package(Qt5Core ${QT_VERSION_REQ} REQUIRED)
    find_package(Qt5Quick ${QT_VERSION_REQ} REQUIRED)
    find_package(Qt5Widgets ${QT_VERSION_REQ} REQUIRED)
    set(CMAKE_AUTOMOC ON)
    
    add_executable(${PROJECT_NAME} ${SOURCES})
    target_link_libraries(${PROJECT_NAME}
        Qt5::Core
        Qt5::Quick
        Qt5::Widgets     
    )
    

    And better use QtQuick instead of QWidgets if you can.

    0 讨论(0)
提交回复
热议问题