cmake issue: includes

Alexander Neundorf neundorf at
Thu Mar 30 20:34:47 BST 2006

On Thursday 30 March 2006 15:39, David Faure wrote:
> On Thursday 30 March 2006 15:21, Adriaan de Groot wrote:
> > It remains clear as mud to me *how* the include paths are calculated and
> > where they are set -- and why they are in the order they are. I would
> > largely expect compiles to have the includes in the following order:
> >
> > KDE includes
> > Qt includes
> > Extra includes (is there even an --with-extra-includes functionality?)
> > X11 includes
> Yes.
> > Now, if I look at the compilation of DCOP, I see in DCOP's CMakefile
> >
> > include_directories( ${QT_INCLUDES} )
> > which adds the Qt includes *at the end of the list to look in*. Why is
> > that even necessary? Why isn't QTDIR/include (or its subdirs) added
> > automatically?
> 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 ...)

(or "kde4_include_directories" or "kde4_add_include_directories" or ... 
"macro_include_directories" or "macro_add_include_directories" or ...)

and which defaults to BEFORE.

What do you think ?

> > Why *is* X11_INCLUDES added in the generic includes for everyone?
> Someone was lazy, 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.
Otherwise people would have complained "why do I have to write them down 
everywhere each time again one by one.".

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

More information about the kde-core-devel mailing list