[CMake] Program with Qt opening with a bash screen on windows before showing the gui...

David Cole david.cole at kitware.com
Wed Nov 30 19:26:57 EST 2011


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


More information about the CMake mailing list