How to link QtMain in CMake with Qt5?

后端 未结 3 1547
無奈伤痛
無奈伤痛 2020-12-30 02:05

I upgraded my project code from Qt4 to Qt5. It uses CMake. The conversion got well except for one line of Cmake commands related to Qt. I can’t find in current documentation

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 02:12

    EDIT : Thanks to Archi comment (see below), simply add

    target_link_libraries( Qt5::WinMain)
    

    or

    target_link_libraries( ${Qt5Core_QTMAIN_LIBRARIES})
    

    in your application's CMakeLists.txt. Both syntaxes worked for me.

提交回复
热议问题