デバッグコードの時、QTはwin mainに対して特別なサポートがあることを発見しました。

1613 ワード

デバッグコードの時、QTはwin mainに対して特別なサポートがあることを発見しました。
http://stackoverflow.com/questions/14115024/how-to-link-qtmain-in-cmake-with-qt5
外国人は本当に大変です
I up graded my project code from Qt 4 to Qt 5.I t uses CMake.The conversion got well except for one line of Cmake command related to Qt.I can’t find in current documentation,like
  • http://qt-project.org/doc/qt-5.0/qtdoc/cmake-manual.html
  • http://qt-project.org/doc/qt-5.0/qtdoc/qtmain.html
  • How to link with QtMan from CMake(with Qt 5)?
    It is the only missing bit to convert my project.Can someone point me to a doc explining this or explining how to do it with Qt 5?My Qt 4 code workd corectlybut the macro I can't find the Cmake macro for Qt 5.
    EDIT>Here is the CMake file I have the moment:https://bitbucket.org/klaim/aos_qt 5/src/593 c 195 c 4 c 6889 f 6968 d 68 f ca 018 ef 425783 a 063/tools/aosdesigner/CMakeLists.txt?at=wip_qt 5
    All qt 5 necessary CMake macros have been set corectly I belive、the only thing that don't work is the linking to QtMain that dothing、as expected since there shound a Qt 5 specifinic of dong the got's
    You can browse the file history to see how it was working with Qt 4.
     
    EDIT:Thanks to Archicoment(see below)、simply add
    target_link_libraries(<your_app> Qt5::WinMain)
    or
    target_link_libraries(<your_app> ${Qt5Core_QTMAIN_LIBRARIES})
    in your appication's CMakeLists.txt.Both syntaxs workd for me.
     
     
    ////////////////////////////
    ついでにCMAKE 2.8.10にある特性を紹介します。
    ADD_EXECUTABLE(**)  WIN 32*)