Maybe you must also add the following line: SET(QT_USE_QTMAIN TRUE)
Best Regards NoRulez Am 01.12.2011 um 19:25 schrieb Michael Jackson <[email protected]>: > And in a cross platform environment you want to detect the system being > compiled for and insert the proper keyword to "add_executable()". > > # Default GUI type is blank > set(GUI_TYPE "") > > #-- Configure the OS X Bundle Plist > if (APPLE) > SET(GUI_TYPE MACOSX_BUNDLE) > elseif(WIN32) > set(GUI_TYPE WIN32) > endif() > > add_executable(myprogram ${GUI_TYPE} ${SOURCES}) > > Just for completeness. > > If you search the CMake Wiki there is a complete working Qt example which has > some of the deployment issues worked out also. > ___________________________________________________________ > Mike Jackson Principal Software Engineer > BlueQuartz Software Dayton, Ohio > [email protected] www.bluequartz.net > > On Dec 1, 2011, at 12:06 PM, Ben Medina wrote: > >> Qt also provides qtmain.lib to resolve the need for WinMain, in case >> you run into that linker error. >> >> On Wed, Nov 30, 2011 at 4:26 PM, David Cole <[email protected]> wrote: >>> On Wed, Nov 30, 2011 at 6:51 PM, Renato Utsch <[email protected]> wrote: >>>> Hello CMake guys... >>>> >>>> Well, I was writing a portable program using CMake that uses Qt as it's GUI >>>> framework... >>>> >>>> I compiled it on linux and it worked really well, no problems. But when >>>> compiling on Windows, the program opened a blank bash screen before opening >>>> the proper gui. I thought that this could be with Qt itself, but when I >>>> tried with qmake, the program runned normally, without any bash screen >>>> opening... >>>> >>>> I used the Visual C++ Express 2008 to compile, with Qt libraries 4.7.4 for >>>> the Visual 2008. Here is the CMakeLists.txt: >>>> >>>> project(test CXX) >>>> cmake_minimum_required(VERSION 2.8) >>>> find_package(Qt4 REQUIRED) >>>> include(${QT_USE_FILE}) >>>> set(test_SRCS >>>> main.cpp >>>> MainWindow.cpp >>>> ) >>>> set(test_MOC_SRCS >>>> MainWindow.hpp >>>> ) >>>> >>>> set(test_RCCS >>>> rc.qrc >>>> ) >>>> qt4_wrap_cpp(test_MOCS ${test_MOC_SRCS}) >>>> qt4_add_resources(test_RCC_SRCS ${test_RCCS}) >>>> add_definitions(-DQT_NO_DEBUG) >>>> add_executable(test >>>> ${test_SRCS} >>>> ${test_MOCS} >>>> ${test_RCC_SRCS}) >>>> target_link_libraries(test ${QT_LIBRARIES}) >>>> >>>> If there is any solution to this I would be very grateful, because I really >>>> want to use CMake. >>>> >>>> >>>> Thanks! >>>> >>>> >>>> Renato >>>> >>>> -- >>>> >>>> Powered by www.kitware.com >>>> >>>> Visit other Kitware open-source projects at >>>> http://www.kitware.com/opensource/opensource.html >>>> >>>> Please keep messages on-topic and check the CMake FAQ at: >>>> http://www.cmake.org/Wiki/CMake_FAQ >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> http://www.cmake.org/mailman/listinfo/cmake >>> >>> Add the WIN32 argument to add_executable to tell it it's a Windows app >>> and not a console app. >>> >>> Like this: >>> >>> add_executable(test WIN32 >>> ${test_SRCS} >>> ${test_MOCS} >>> ${test_RCC_SRCS}) >>> >>> >>> HTH, >>> David >>> -- >>> >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Please keep messages on-topic and check the CMake FAQ at: >>> http://www.cmake.org/Wiki/CMake_FAQ >>> >>> Follow this link to subscribe/unsubscribe: >>> http://www.cmake.org/mailman/listinfo/cmake >> -- >> >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://www.cmake.org/mailman/listinfo/cmake > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
