[CMake] Different INCLUDE_DIRECTORIES for each library

Paul Richards paul.richards at gmail.com
Fri Jul 6 09:31:19 EDT 2007


On 06/07/07, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
> On Friday 06 July 2007 09:12, Paul Richards wrote:
> > On 06/07/07, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
> > > On Friday 06 July 2007 07:45, Paul Richards wrote:
> > > > Hi,
> > > > I have one large CMakeLists.txt file which defines multiple static
> > > > libraries.  I'm currently using INCLUDE_DIRECTORIES which sets the
> > > > include path for all of them at once.  Can I set different include
> > > > directories for each static lib?
> > >
> > > This is  currently not really possible, include directories are per
> > > directory. There may be an improvement there in cmake 2.6 (which will
> > > still needs some months) or you could use
> > > SET_TARGET_PROPERTIES(COMPILE_FLAGS "-I dir"), but then cmake won't know
> > > about the include dirs and e.g. the dependency scanning might not work.
> >
> > What do you mean by "include directories are per directory"?
>
> The include directories you define using INCLUDE_DIRECTORIES() are used for
> all targets defined in this CMakeLists.txt and they are also "inherited" to
> all CMakeLists.txt in subdirectories added using SUBDIRS() or
> ADD_SUBDIRECTORY(). In these subdirectories you can add more include
> directories if you want to.
>

So for this to work I am forced to split my CMakeLists.txt file into
separate parts spread across different directories.  Correct?

-- 
Paul Richards


More information about the CMake mailing list