[CMake] Program with Qt opening with a bash screen on windows before showing the gui...
Michael Jackson
mike.jackson at bluequartz.net
Thu Dec 1 14:17:59 EST 2011
This is what I have in my own CMakeLists.txt file:
# ------------------------------------------------------------------------------
# Qt 4 Section
# ------------------------------------------------------------------------------
# by default only QtCore and QtGui modules are enabled
# other modules must be enabled like this:
IF (WIN32)
SET (QT_USE_QTMAIN TRUE)
ENDIF (WIN32)
# this command finds Qt4 libraries and sets all required variables
# note that it's Qt4, not QT4 or qt4
FIND_PACKAGE( Qt4 REQUIRED )
___________________________________________________________
Mike Jackson Principal Software Engineer
BlueQuartz Software Dayton, Ohio
mike.jackson at bluequartz.net www.bluequartz.net
On Dec 1, 2011, at 2:10 PM, norulez at me.com wrote:
> 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 <mike.jackson at bluequartz.net>:
>
>> 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
>> mike.jackson at bluequartz.net 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 <david.cole at kitware.com> wrote:
>>>> On Wed, Nov 30, 2011 at 6:51 PM, Renato Utsch <renatoutsch at gmail.com> 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
>
More information about the CMake
mailing list