cmake kdevelop 4

7 dec 2009

motivation

i’ve converted the second project to use ‘cmake’. this time an qt4 application which usually uses qmake.

i love cmake. it is easy to use (once you get used to the cmake of doing things). i love ‘out of source’ builds. kdevelop4 can handle cmake so i decided to move into the future and use cmake for my kdevelop4 projects as well. so far a very good decision.

i did have problems at first. using cmake with normal cpp/h files is easy and well documented but using it with moc|uic|rcc is different. i searched for help in irc.freenode.net#cmake and ‘Marc Bowes’ gave me a link [2] to his github.com project which uses cmake for a qt4 project - an excellent resource. looking at that code made my work easy.

in case you want to convert your qt4 applications from qmake to cmake see [1] and [2]. in general i recommend reading [3], [4] and [5].

i probably said enought about cmake but one more thing a kde developer told to me:

when using cmake with uic (when using qt4) one has to maintain a list of QObject deriving classes which are then processed by a macro called: ‘QT4_WRAP_UI’. He said when using cmake with kde4 projects cmake does this automagically. This sounds great - maybe someone ports that code over to the qt4 macro - would be nice!

So finally some words about kdevelop4. I loved kdevelop3 but refactoring was a pain with kdevelop3 - that changed with kdevelop4. The language parser and ‘auto completion’ feature now works so well you don’t think of kdevelop4 as a normal editor with syntax highlighting but more as a fully automated code generator.

Kdevelop4 can now have several projects in one widget (in kdevelop3 i needed two instances - resulting in issues since starting the second instance usually would resume the project which was used at last so one would end up having two IDEs with the same project opened). Kdevelop4 has also support for several worksets - this is one of the best features. Currently i consider it the greatest c++ IDE i’ve ever used and i didn’t even mention ‘compile sets’ yet…

#links

article source