KDE/kdelibs/cmake/modules

Brad King brad.king at kitware.com
Thu Feb 16 16:41:41 CET 2006


David Faure wrote:
> If I put that in kdelibs/CMakeLists.txt it will only make subdirs inherit "build/kdelibs" 
> but not "build/kdelibs/kio/kfile", when compiling from kdelibs/kio/kfile, right?

Correct.

> I'm surprised that "current source dir" and "current binary dir" aren't automatically
> in the include dirs - and aren't first in that list, if they are. It seems common sense
> that #include "foo.h" or "foo.generated" should look in the current source/binary dir first.

Older versions of CMake (before 2.0 I think) did actually include the 
binary directory corresponding to a source directory as the first 
include path so that this would work.  The feature was removed when 
several users had problems that could not be resolved with the feature 
present, and we decided that everyone should just specify the include 
path they want.

To my knowledge KDE is the first project to use CMake that has so many 
generated headers in every directory.  It is also a design choice that 
the generated headers are included with

#include "myheader.h"

instead of

#include <kde/mytool/myheader.h>

which requires only a few include paths.  I'm not commenting on whether 
one of these design choices is better than the other, just that the need 
for this feature is not common to all projects and therefore should not 
be provided unconditionally.

Clearly this simple CMake feature can help avoid alot of extra 
error-prone code for KDE.  The question is how to enable the feature on 
a per-project or per-target basis.  I'll discuss this with other CMake 
developers and come back with a solution.

-Brad


More information about the Kde-buildsystem mailing list