Reputation: 411
I am having trouble finding out the current up-to-date method for building non-console apps using cmake, Qt5 and Visual C++ under Windows. It looks like back in the Qt4 days it was sufficient to set QT_USE_QTMAIN to true. Now supposedly it's sufficient to link Qt5::WinMain. However, neither of these is working for me - my app continues to open a console window. I also cannot find anything in either the cmake or the Qt documentation.
What's the documented/proven method to get the app to stop opening a console window?
Upvotes: 0
Views: 2321
Reputation: 6734
You need to add set_target_properties(<targetname> PROPERTIES WIN32_EXECUTABLE TRUE)
to your executable target in CMakeLists.txt
to let CMake generate the executable for windows without a console. This replaces the main
entry point of the application with WinMain
.
Upvotes: 5