Название: [РЕШЕНО]CMake + Win32 - консоль
Отправлено: Vitto74 от Январь 11, 2011, 13:19
Доброго времени суток. Перевел проект с qmake на cmake. Скомпилилось без проблем, но на винде при запуске непременно появляется консоль. Как бороться с таким явлением? project(SunnyChat) cmake_minimum_required( VERSION 2.6 )
if (UNIX AND NOT APPLE) set (PROJECT_NAME_GLOBAL sunnychat) else (UNIX AND NOT APPLE) set (PROJECT_NAME_GLOBAL SunnyChat) endif (UNIX AND NOT APPLE)
find_package( Qt4 4.5.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtWebkit REQUIRED ) include( ${QT_USE_FILE} )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE "Debug") endif (NOT CMAKE_BUILD_TYPE)
if (NOT SHARE_DIR) set (SHARE_DIR "share") endif (NOT SHARE_DIR)
set (CLIENT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/${SHARE_DIR}/${PROJECT_NAME_GLOBAL}") set (PIXMAP_DIR "${CMAKE_INSTALL_PREFIX}/${SHARE_DIR}/pixmaps")
set (CLIENT_TRANSLATIONS_DEST "${CLIENT_DATA_DIR}/qt/ts")
if (UNIX) set (BINDIR bin) elseif (WIN32) set (BINDIR .) endif (UNIX)
set (LANGUAGES ru )
set (target_basename "translations_qt")
set (DATA_DIR ${CLIENT_DATA_DIR}) set (PRO_NAME ${PROJECT_NAME_GLOBAL}) set (PIX_DIR ${PIXMAP_DIR}) configure_file(config.h.in config.h)
message(STATUS "CLIENT_DATA_DIR: " ${CLIENT_DATA_DIR}) message(STATUS "CLIENT_TRANSLATIONS_DEST: " ${CLIENT_TRANSLATIONS_DEST}) message(STATUS "PROJECT_NAME_GLOBAL: " ${PROJECT_NAME_GLOBAL}) message(STATUS "BINDIR: " ${BINDIR})
set (SOURCES src/QXMPP/QXmppVersionIq.cpp src/QXMPP/QXmppVCardManager.cpp src/QXMPP/QXmppVCard.cpp src/QXMPP/QXmppUtils.cpp src/QXMPP/QXmppTransferManager.cpp src/QXMPP/QXmppStun.cpp src/QXMPP/QXmppStreamInitiationIq.cpp src/QXMPP/QXmppStreamFeatures.cpp src/QXMPP/QXmppStream.cpp src/QXMPP/QXmppStanza.cpp src/QXMPP/QXmppSocks.cpp src/QXMPP/QXmppSession.cpp src/QXMPP/QXmppRpcIq.cpp src/QXMPP/QXmppRosterManager.cpp src/QXMPP/QXmppRosterIq.cpp src/QXMPP/QXmppRemoteMethod.cpp src/QXMPP/QXmppReconnectionManager.cpp src/QXMPP/QXmppPresence.cpp src/QXMPP/QXmppPingIq.cpp src/QXMPP/QXmppPacket.cpp src/QXMPP/QXmppNonSASLAuth.cpp src/QXMPP/QXmppMucManager.cpp src/QXMPP/QXmppMucIq.cpp src/QXMPP/QXmppMessage.cpp src/QXMPP/QXmppLogger.cpp src/QXMPP/QXmppJingleIq.cpp src/QXMPP/QXmppIq.cpp src/QXMPP/QXmppInvokable.cpp src/QXMPP/QXmppIbbIq.cpp src/QXMPP/QXmppElement.cpp src/QXMPP/QXmppDiscoveryIq.cpp src/QXMPP/QXmppDataForm.cpp src/QXMPP/QXmppConstants.cpp src/QXMPP/QXmppConfiguration.cpp src/QXMPP/QXmppCodec.cpp src/QXMPP/QXmppClient.cpp src/QXMPP/QXmppCallManager.cpp src/QXMPP/QXmppByteStreamIq.cpp src/QXMPP/QXmppBind.cpp src/QXMPP/QXmppArchiveManager.cpp src/QXMPP/QXmppArchiveIq.cpp src/main.cpp src/mainwindow.cpp src/myclient.cpp src/logmanager.cpp src/tabroom.cpp src/roomconf.cpp src/systray.cpp src/imagemanager.cpp src/connectform.cpp src/settingsdialod.cpp src/settingsmanager.cpp src/transferdialog.cpp src/registerform.cpp src/global.cpp src/useritem.cpp src/vcarddialog.cpp )
set (HEADERS src/QXMPP/QXmppVersionIq.h src/QXMPP/QXmppVCardManager.h src/QXMPP/QXmppVCard.h src/QXMPP/QXmppUtils.h src/QXMPP/QXmppTransferManager.h src/QXMPP/QXmppStun.h src/QXMPP/QXmppStreamInitiationIq.h src/QXMPP/QXmppStreamFeatures.h src/QXMPP/QXmppStream.h src/QXMPP/QXmppStanza.h src/QXMPP/QXmppSocks.h src/QXMPP/QXmppSession.h src/QXMPP/QXmppRpcIq.h src/QXMPP/QXmppRosterManager.h src/QXMPP/QXmppRosterIq.h src/QXMPP/QXmppRoster.h src/QXMPP/QXmppRemoteMethod.h src/QXMPP/QXmppReconnectionManager.h src/QXMPP/QXmppPresence.h src/QXMPP/QXmppPingIq.h src/QXMPP/QXmppPacket.h src/QXMPP/QXmppNonSASLAuth.h src/QXMPP/QXmppMucManager.h src/QXMPP/QXmppMucIq.h src/QXMPP/QXmppMessage.h src/QXMPP/QXmppLogger.h src/QXMPP/QXmppJingleIq.h src/QXMPP/QXmppIq.h src/QXMPP/QXmppInvokable.h src/QXMPP/QXmppIbbIq.h src/QXMPP/QXmppElement.h src/QXMPP/QXmppDiscoveryIq.h src/QXMPP/QXmppDataForm.h src/QXMPP/QXmppConstants.h src/QXMPP/QXmppConfiguration.h src/QXMPP/QXmppCodec.h src/QXMPP/QXmppClient.h src/QXMPP/QXmppCallManager.h src/QXMPP/QXmppByteStreamIq.h src/QXMPP/QXmppBind.h src/QXMPP/QXmppArchiveManager.h src/QXMPP/QXmppArchiveIq.h src/mainwindow.h src/myclient.h src/settingsmanager.h src/logmanager.h src/tabroom.h src/roomconf.h src/systray.h src/imagemanager.h src/connectform.h src/settingsdialod.h src/transferdialog.h src/registerform.h src/qmywebpage.h src/global.h src/useritem.h src/vcarddialog.h )
qt4_wrap_cpp( MOC_SOURCES ${HEADERS} )
set (FORMS ui/mainwindow.ui ui/tabroom.ui ui/roomconf.ui ui/connectform.ui ui/settingsdialod.ui ui/transferdialog.ui ui/registerform.ui ui/useritem.ui ui/vcarddialog.ui )
qt4_wrap_ui( UI_HEADERS ${FORMS} )
add_executable( SunnyChat ${SOURCES} ${MOC_SOURCES} ${UI_HEADERS} ) target_link_libraries( SunnyChat ${QT_LIBRARIES} )
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/translations/) foreach (LANGUAGE ${LANGUAGES}) set (TS ${CMAKE_CURRENT_SOURCE_DIR}/translations/${LANGUAGE}.ts) set (QM ${PROJECT_BINARY_DIR}/translations/${LANGUAGE}.qm) list (APPEND TRANSLATIONS ${TS}) list (APPEND TRANSLATIONS_BINARY ${QM}) add_custom_command ( OUTPUT "${QM}" DEPENDS "${TS}" COMMAND ${QT_LRELEASE_EXECUTABLE} ARGS "${TS}" -qm "${QM}") add_custom_target(${target_basename}_${LANGUAGE} DEPENDS ${QM}) endforeach()
add_custom_target(${target_basename} ALL DEPENDS ${TRANSLATIONS_BINARY})
install (TARGETS SunnyChat DESTINATION ${BINDIR}) install (DIRECTORY ${PROJECT_BINARY_DIR}/translations/ DESTINATION ${CLIENT_DATA_DIR}/translations/) install (DIRECTORY icons/ DESTINATION ${CLIENT_DATA_DIR}/icons/) install (DIRECTORY smiles/ DESTINATION ${CLIENT_DATA_DIR}/smiles/) install (FILES SunnyChat.png DESTINATION ${PIXMAP_DIR}/ RENAME ${PROJECT_NAME_GLOBAL}.png) if (UNIX) install (FILES sunnychat.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/${SHARE_DIR}/applications") endif (UNIX)
Название: Re: CMake + Win32 - консоль
Отправлено: crackedmind от Январь 11, 2011, 13:51
http://www.devexp.ru/2010/01/cmake-i-qt/ Ищем раздел "Убираем консольное окно в Windows"
Название: Re: CMake + Win32 - консоль
Отправлено: Vitto74 от Январь 11, 2011, 15:46
Спасибо, помогло
|