current state of using cmake to compile kdevelop

Alexander Neundorf neundorf at
Sun May 8 18:49:05 UTC 2005


since some weeks I'm trying to compile kdevelop using cmake (since I only find 
once or twice per weeks a few hours to work on it it takes some time...).

So, what's the current state:
The whole kdevelop module compiles and links.
I'm currently in the process of adding the install rules

There are some issues (all solved or solvable):

1) there is a very kdevelop-specific problem related to cmake: in kdevelop 
there exists the binary "kdevelop" and the library "". Since in 
cmake all libs are only referenced by the actual name (i.e. without prefix 
and suffix) libkdevelop is also only "kdevelop" in cmake. So when I simply 
TARGET_LINK_LIBRARY(kdevpropeditor kdevelop) 
which should link the executable kdevpropeditor to, cmake got 
slightly confused and started to build the executable kdevelop.
works for now, but is not nice.
Either cmake has to be changed so that it can handle this situation better or or the kdevelop binary would have to be renamed 
( ?)

2) there are some directories (e.g. kdevprojectmanager) where binaries or 
shared libs link to a libraries in one of its subdirectories.
This is currently a small problem for cmake, if the executable would be built 
in a directory "parallel" to the lib then cmake could handle the library 
dependencies better. I'm waiting for an answer from the cmake-guys to this 

3) libtool convenience libraries
cmake doesn't really support "convenience" static libraries, i.e. libs which 
are included completely when linked to an application or a shared library.
I implemented a small workaround so that it is possible to build static libs 
which behave the same way. This would have to be extended for platforms other 
than linux. 
Or maybe even better just get rid of the convinience libs and simply compile 
the sources from the subdirectories directly into the shared libs. Would 
there be a problem with this ? 

4) plugins
KDE loads plugins using libltdlopen. This seems to depend on the libtool la 
files. I don't know much about these files. I implemented a cmake macro which 
produces files which look similar to "real" la-files. 
They also contain an entry "dependency_libraries". I'm not sure what to insert 
there. The original la-files among others also list other la-files in this 
entry. Is this necessary ?

5) I have not yet written any configure checks. What should be checked ? In 
which directories ?

A typical CMakeLists.txt - file currently looks like this:


#list the sources
    abbrevpart.cpp abbrevconfigwidget.cpp addtemplatedlg.cpp )

#list the ui files
    abbrevconfigwidgetbase.ui addtemplatedlgbase.ui )

#generate rules for the moc files

#generate rules for the ui files
KDE_ADD_UI_FILES(kdevabbrev_PART_SRCS ${kdevabbrev_UI} )

#most important line: build a library
ADD_LIBRARY(kdevabbrev MODULE ${kdevabbrev_PART_SRCS})

#link some libs to

#macro for creating the libtool la file

#install the library
INSTALL_TARGETS(/lib/kde3/lib kdevabbrev)


More stuff could be integrated into cmake macros (e.g. to recognize the suffix 
of the input files and automatically call the MOC and UI macros on them, 
adding the install rules automatically etc.) But IMO adding more magic 
doesn't always mean it gets easier to understand.

Work: alexander.neundorf at -
Home: neundorf at                -
      alex at               -

More information about the KDevelop-devel mailing list