cmake issue: includes

David Faure faure at
Thu Mar 30 23:28:55 BST 2006

On Thursday 30 March 2006 23:00, Adriaan de Groot wrote:
> On Thursday 30 March 2006 21:34, Alexander Neundorf wrote:
> > On Thursday 30 March 2006 15:39, David Faure wrote:
> > > Because it needs to be before any kdelibs-local includes, as you pointed
> > > out at the beginning of this mail. So I can't just put QT_INCLUDES in the
> > > toplevel CMakeLists.txt, unless we use "include_directories( BEFORE ...
> > > )" everywhere, which people will surely forget to do.
> >
> > I think so too.
> > The response to the idea to make the order of the include dirs configurable
> > was not too positive from the cmake developers.
> > Their suggestion was to add a macro which does just that:
> >
> > add_include_directories( [BEFORE | AFTER] dir1 dir2 ...)
> > What do you think ?

Where AFTER means "even after those that will be added later on and that are neither before nor after"?
This is a bit unclear and that's why I had suggested a add_global_include_directory()
or a add_include_directories( LAST ) or something like that.

"After" the currently listed directories is the current behavior, so AFTER is unclear imho.

> > Well, I considered it a good idea of doing
> > include_directories( ${KDE4_INCLUDES} ) gives you basically everything you
> > need: KDE, Qt and with X11 also the X includes.
But most KDE/Qt code should NOT use X, this is why I'm not sure that we really
need X in there. Hmm. OK. On the other hand it doesn't harm to have it...

> Does it make sense to do the following:
> 1) In the root CMakefile, include_directories() *only* for the source and 
> build dirs. Those are going to be first anyway.

Yes [you know that this is about the toplevel source/build dir, not about
the per-subdir locations, right?]. The per-subdir "-I$srcdir -I$builddir"
is done by the CMAKE_INCLUDE_CURRENT_DIR setting.

> 2) Make sure that the KDE4_*_INCLUDES are set correctly (KDE / Qt / other / 
> X11) and require each subdir to include_directories() the relevant one.

Yes, that was my idea too.

> It's important not to slip in any autodetected paths for dependencies into the 
> includes, since sometimes we *need* to pull stuff out of KDE (source) and not 
> any system installed bits. libltdl is such a case, which I'm going to work on 
> right now.

I simply needs to be in the kdecore/CMakeLists.txt.

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list