[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    KDE/kdelibs/cmake/modules
From:       faure () kde ! org (David Faure)
Date:       2006-02-16 14:47:46
Message-ID: 200602161547.46781.faure () kde ! org
[Download RAW message or body]

On Thursday 16 February 2006 15:35, Brad King wrote:
> David Faure wrote:
> > Because the gcc command line says -Ibuild/kabc -Ibuild/kabc/kab,
> > the #include "addressbook.moc" from kab/addressbook.cc still picks up the moc
> > file in build/kabc.
> > 
> > -I${CURRENT_BINARY_DIR} should be first but I don't know how to make that
> > happen. Editing include_directories() doesn't help, since that stuff is appended to
> > a lot of other stuff that comes before automatically (somehow...).
> > 
> > Hmm, is the include_directories of CMakeLists.txt in parent directories propagated to
> > its subdirs? It looks like it (in which case we can clean up a lot of include_directories
> > statements) - but in which case there's no way to do what I'm looking for.
> 
> Yes, include directories are inherited, but you can use the BEFORE 
> option to prepend.  See the documentation for the include_directories 
> command.
> 
> INCLUDE_DIRECTORIES
>     Add include directories to the build.
> 
>       INCLUDE_DIRECTORIES([BEFORE] dir1 dir2 ...)
> 
>     Add the given directories to those searched by the compiler for
>     include files.  If BEFORE is specified, the directories are prepended
>     onto the current list of directories instead of appended.

Ah. But could we make it so that  -I${CURRENT_BINARY_DIR} is first for any
subdir of kdelibs? I wouldn't want to require that every CMakeLists.txt has to say so...

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?

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.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic