[Qt-interest] Lots of problems with cmake.

Dorosky, Christopher G christopher.g.dorosky at lmco.com
Fri Jun 12 17:15:29 CEST 2009


This has been a real chore.

 

I've got a development project that runs cmake nicely. Now I am adding
QT. Let the fun begin.

 

As an example, I decided to try to get the broadcastsender example to
compile and link. 

What misery. It seems like there is an awful lot of bad information on
the web.

 

Here is the CMakeLists.txt

I've crammed lots of different suggestions in here, so it's a mess.

 

cmake_minimum_required(VERSION 2.6)

 

# why do I have to do this, shouldn't this work already?

# I don't have to do it for other cmake projects....

set(CMAKE_FIND_LIBRARY_PREFIXES lib)

set(CMAKE_FIND_LIBRARY_SUFFIXES .so)

 

# find QT4

find_package(Qt4 REQUIRED)

 

# one problem at a time, comment out for now.

#set(QT_USE_OPENGL TRUE)

 

# what on earth does this do?

include(${QT_USE_FILE})

 

#convenience variables.

set(qtproject_SRCS main.cpp sender.cpp)

set(qtproject_INC sender.h)

 

#start the project settings.

PROJECT (qttest)

ADD_EXECUTABLE(qttest ${qtproject_SRCS})

QT4_WRAP_CPP(${qtproject_SRCS} ${qtproject_INC})

 

# The QT4_WRAP_CPP generates this cmake error

#CMake Error: Attempt to add a custom rule to output

# "/home/doroskcg/code/qhrimgr/qttest/moc_sender.cxx.rule" which already
has a

# custom rule.

# without it, I get a Makefile and can compile but not link since there
are

# no moc files. I get vtable lookup errors.

 

#what on earth does this do?

#add_definitions( ${QT_DEFINITIONS})

 

# bad mojo. it wants moc files that have to be manually generated???

#qt4_automoc(${qtproject_SRCS} ${qtproject_INC})

 

# Complete guesses at library names.

TARGET_LINK_LIBRARIES(qttest ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARIES}
${QT_QTGUI_LIBRARIES} ${QT_QTCORE_LIBRARIES})

 

As you can see, I'm totally grasping at straws trying to get this to
work. 

 

Any help is appreciated.

 

Chris

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090612/08238654/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
Url: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090612/08238654/attachment.txt 


More information about the Qt-interest-old mailing list