On 03/03/2010 10:06 AM, Matt Williams wrote:
On 3 March 2010 16:01, Hicham Mouline<hic...@mouline.org>  wrote:
Hello,

I have a library that contain the core of my application.
I have been running this application in text-mode so far. I will now extend it 
to use a GUI, and I've chosen Qt.

I have used cmake to generate Makefiles on linux/g++4.x and solutions files on 
win32/vs2008.

Qt comes with qmake which takes .pro files as input and also generates 
Makefiles or vs2008 solution files.

Is there a generally advised policy re combining systems with both cmake and 
qmake?

Any suggestions are appreciated,
You don't need to (and if you're using cmake - shouldn't) use qmake at
all. It's very simple to reimplement all the qmake rules using CMake
and the FindQt4.cmake package.

See http://www.bineteri.com/qtwithcmake and http://qtnode.net/wiki/Qt_with_cmake


The simplest Qt cmake file I've come up with, based on converting from a Qmake build, is the following - it should be easy to follow and modify.

# Minimal QT Build
# CMake cross-platform build system recipe
# 2010 Ryan Pavlik <rpav...@iastate.edu> <abir...@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC

cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)

# Set package properties
project(qtExample)

###
# Perform build configuration of dependencies

# Set up QT4 and required components
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
include(${QT_USE_FILE})

###
# All the project files
set(SOURCES
    main.cpp
    mywindow.cpp
    progressbar.cpp
    trainingdisplay.cpp
    TheApp.cpp)

set(HEADERS
    datastorage.h
    train.h)

set(MOCS
    mywindow.h
    progressbar.h
    TheApp.h)

set(UIS ui/TheApp.ui)

set(RESOURCES theappresources.qrc)

###
# Build and link the project

# Let QT pre-process the files and add the generated files to the source list
qt4_wrap_ui(GENERATED_SOURCES ${UIS})
qt4_add_resources(GENERATED_SOURCES ${RESOURCES})
qt4_wrap_cpp(GENERATED_SOURCES ${MOCS})

source_group("Generated Sources - Do Not Edit" FILES ${GENERATED_SOURCES})

# Make sure the compiler can find the pre-processed files from qt4_wrap_ui
include_directories("${CMAKE_BINARY_DIR}")

# Build the app!
add_executable(qt-example
    MACOSX_BUNDLE
    WIN32
    # source files that are actually built direclty
    ${SOURCES}
    ${GENERATED_SOURCES}

    # items included so they show up in your IDE
    ${HEADERS}
    ${UIS}
    ${MOCS}
    ${RESOURCES})

# Link the app!
target_link_libraries(qt-example ${QT_LIBRARIES})


--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik

_______________________________________________
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

Reply via email to