[CMake] Inheriting include directories from dependencies

Michael Jackson mike.jackson at bluequartz.net
Fri Jan 16 15:52:15 EST 2009



On Jan 15, 2009, at 10:45 PM, Robert Dailey wrote:

> Hi,
>
> Currently I'm specifying include directories on a per-project basis.  
> Suppose I have projects A, B, and C. Project C would depend on A and  
> B by specifying A and B in a call to target_link_libraries(). Both  
> projects A and B have include directories that I set via a call to  
> include_directories() and the directories are not the same. The  
> include directories I use are those given to me by various Find  
> modules (find_package()).
>
> The thing is that include files in A and B (Which I reference in the  
> source code for project C) include header files in external  
> dependencies of A and B. This means that project C will not compile  
> unless it has the include directories available for the dependencies  
> of both A and B. Is there a built in feature that facilitates  
> inheriting include directories from A and B and placing them into C  
> implicitly? If not, is there some work-around for this?
>
> Thanks.

I have a project with a similar setup and basically what I do for  
Project C is look for Project A, once I find Project A, there is a  
specific file that looks for all the dependencies of A and adds the  
appropriate variables like include_directories, libraries and such.

  This works out generally well because both projects are at the same  
directory level in my CVS repository so it is generally easy to find  
Project A from Project C.

Other projects, like Qt, VTK and ITK all have a "USE_FILE" that has  
all the needed information like include directories, library  
directories and such. I think this is the way (for now) to do what you  
need to do.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio




More information about the CMake mailing list