KDE/kdelibs/cmake/modules

Brad King brad.king at kitware.com
Thu Feb 16 15:35:38 CET 2006


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.

-Brad

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.



More information about the Kde-buildsystem mailing list