Forwarding headers for kdelibs

Hamish Rodda rodda at
Thu Oct 12 14:37:44 BST 2006

On Monday 02 October 2006 23:02, Hamish Rodda wrote:
> Hi,
> Just wanted to let you know I've started work on creating forwarding
> headers for kdelibs classes, to support Qt4 style includes on kde classes. 
> This can of course be extended to any other kde library.
> My generator uses both the build system and a c++ parser (Roberto's
> kdevelop-pg like c++ parser, which will be in kdevelop4).  This means that
> the generated headers should be correct, even down to only generating
> headers for exported classes only.  (There is a problem at the moment
> because I am not parsing other included headers, and thus macros can get in
> the way of correct parsing, but I intend to fix this.)
> To try these headers out, you can eg. symlink the directory
> (branches/work/forwardingincludes) to kdelibs/includes, and then add the
> add_subdirectory line to the top CMakeLists.txt file.  The includes are
> then installed under <yourkde4includedir>/KDE, so that includes like the
> following should work:
> #include <KDE/KConfig>
> or, if you also put the include/KDE dir into your include_directories
> statement,
> #include <KConfig>
> Namespaces are handled with subdirectories, eg:
> #include <KDE/KTextEditor/Cursor>
> (or just #include <KTextEditor/Cursor> with the extra include_directories
> statement)
> Currently, I'm not generating forwarding includes for subclasses, as you
> can't have a directory and a file with the same name (eg. #include <KStyle>
> and #include <KStyle/Option> couldn't both work)
> The generator app is at trunk/KDE/kdevelop/languages/cpp/parser/headergen
> (to compile, enable tests).  To use this yourself, you'd need a patched
> cmake (Matt Rogers is working on an xml generator for cmake, and I modified
> it a bit).  Down the track I expect a variant of this patch will be merged
> into cmake so that anyone can then do the header generation themselves.

Ok, so I've now refined the generation program (basically, fixed the 
preprocessor) such that the number of missed classes appears to be minimal.  
Please test this out with a view towards inclusion...  I've started switching 
Kate locally without problems.

BTW, one issue I encountered was that some includes are installed from a 
directory other than the directory in which they are compiled.  This causes 
problems with locating #included headers; would people mind if I moved the 
install commands to the directory in which the libraries are compiled?  Eg, 
khtml/dom/CMakeLists.txt gets moved into khtml/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list