[CMake] INCLUDE_DIRECTORIES per project

Alexander Neundorf a.neundorf-work at gmx.net
Fri Apr 10 17:03:56 EDT 2009


On Friday 10 April 2009, Adrian Boeing wrote:
> Hi,
>
> I would like to have a portable way of having separate include
> directories for each 'project' in my visual studio 'solution'.
> ie:
> common/
> dir/file1
> dir/file2
>
> share the include directory 'common' , and have seperate 'include1'
> and 'include2' directories.
> This would correspond to two 'projects' in my 'solution'
> one with files1 and common,include1 directories
> the other with files2 and common,include2 directories
>
> It is my understanding that INCLUDE_DIRECTORIES is a global setting?

It's a per-directory setting, i.e. if a call to include_directories() applies 
to that directory and all sub directories of it, but not to sibling or parent 
directories.
So you could do 

include_directories(common)
in the toplevel CMakeLists.txt
and additionally 
include_directories(include1) 
and 
include_directories(include2) 
in the dir/file1 and dir/file2 subdirectories.

Alex


More information about the CMake mailing list