[Qt-interest] Lots of problems with cmake.

Andreas Pakulat apaku at gmx.de
Fri Jun 12 18:02:53 CEST 2009


On 12.06.09 10:15:29, Dorosky, Christopher G wrote:
> 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)

First thing should be a project(yourname) call, because that will trigger
quite some initialization.
 
> # why do I have to do this, shouldn't this work already?
> # I don't have to do it for other cmake projects....

Its not necessary if you add the project() line.

> # find QT4
> 
> find_package(Qt4 REQUIRED)

Ok.
 
> # what on earth does this do?

No idea, but its not needed to use Qt.
 
> #start the project settings.
> 
> PROJECT (qttest)

This is too late, move that up after the cmake_minimum_required statement.
 
> 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})

read man cmake, look for add_definitions and also for the FindQt4
paragraph.
 
> # bad mojo. it wants moc files that have to be manually generated???
> 
> #qt4_automoc(${qtproject_SRCS} ${qtproject_INC})

No, but for this to work I think you need to find and install the automoc
tool available from kdesupport or your distribution first. I could be wrong
though, maybe its just a macro that tries to find .moc include's in your
cpp files.
 
> # Complete guesses at library names.

Don't guess, read the documentation, its all in there.

Andreas

-- 
You have a strong appeal for members of the opposite sex.



More information about the Qt-interest-old mailing list