[CMake] intercomponent link dependencies?

Michael Wild themiwi at gmail.com
Wed Jan 13 01:02:49 EST 2010


On 13. Jan, 2010, at 1:55 , Nico Schlömer wrote:

> Pheeew..
> So I've now been trying to include one *single* library from an
> external project (liba.a) into my own project, writing FindA.cmake.
> Somehow I still fail to apply the dependencies correctly. What I do is
> 
> [...]
> ADD_LIBRARY(A STATIC IMPORTED)
> SET_TARGET_PROPERTIES( A PROPERTIES
>                                             IMPORTED_LOCATION
> "${A_LIBRARY}"     %set above
>                                             LINK_INTERFACE_LIBRARIES
> "${A_LINK_INTERFACE_LIBRARIES}"   % set above to something like
> "/usr/lib/liblapack.a;/usr/lib/blas.a;"
>                       )
> [...]
> 
> [Setting TARGET_LINK_LIBRARIES(A LINK_INTERFACE_LIBRARIES
> "${A_LINK_INTERFACE_LIBRARIES}" ) did *not* work for me.]
> 
> Now,  in the main CMakeLists.txt I say Find( A REQUIRED ), and I was
> naivly expecting that upon
> 
> TARGET_LINK_LIBRARIES ( main.out A )
> 
> *all* the dependent libraries would be pulled in too. This is not the case. :/
> 
> What am I missing?
> 
> Cheers,
> Nico
> 
> 


for IMPORTED targets it is IMPORTED_LINK_INTERFACE_LIBRARIES and IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG> if you need different libraries for DEBUG, RELEASE etc: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:IMPORTED_LINK_INTERFACE_LIBRARIES


HTH

Michael



More information about the CMake mailing list