[CMake] multi-tiered config file inclusion

Hugh Sorby h.sorby at auckland.ac.nz
Fri May 28 00:35:24 EDT 2010


Hi All,

The question I have is about our old friend the static library and 
config files.

In my project I use two other libraries that I depend on (both built via 
CMake)
  1. OpenCASCADE
  2. wxWidgets

plus some others.  So, when I build my project in its application form I 
locate the LIB-config.cmake files for the dependent libraries and then 
just insert the include dir and libraries in the appropriate place and 
all is well in my world.  When I build my project as a static library I 
still depend on these two libraries and everything compiles fine.  Now, 
when I try to build and link an application (like a test app) into my 
library the problem occurs.  I was hoping that with the config files I 
would get the desired chaining effect for dependent static libraries.  
But I don't.  What I get is a target name instead of the target location 
that the linker needs.  Because I am no longer including files like 
OpenCASCADE-config.cmake I don't get the imported target information 
because they are another level down (on the include tree).  This only 
happens with CMake targets,  non-CMake targets get set in full and 
propagate well.

Has anyone else come across this, and is there a solution to my 
problem.  I was hoping to have an easy solution where my library would 
drag in all required dependencies without the test application (in this 
case) needing to find them, hence the config files.  Which by the way 
have worked very well for the single tiered situation.

Cheers,




More information about the CMake mailing list