[CMake] intercomponent link dependencies?

Ryan Pavlik rpavlik at iastate.edu
Wed Jan 13 08:04:46 EST 2010


On 1/13/10 6:51 AM, Nico Schlömer wrote:
>> Overlinking is actually only an issue for dynamic libraries. So as long as you're absolutely sure that you only have static libraries, you're fine.
>>      
> Oh, I was thinking it is *unclean* to have a link line like
>
> -llibrarya /usr/local/local/liblapack.a --llibraryb
> /usr/local/local/liblapack.a     (1)
>
> -- which (disappointingly?) is exactly what happens now that I have
> FindLibraryA.cmake and FindLibraryB.cmake, both equipped with
>
>    SET_TARGET_PROPERTIES(A PROPERTIES
>                           IMPORTED_LOCATION "${A_LIBRARY}"
>                           IMPORTED_LINK_INTERFACE_LIBRARIES
> "${A_LINK_INTERFACE_LIBRARIES}"
>                         )
>
> where both ${A_LINK_INTERFACE_LIBRARIES} and
> ${B_LINK_INTERFACE_LIBRARIES} contain /usr/local/local/liblapack.a.
>
>
>    
>> Does the IMPORTED_LINK_INTERFACE_LIBRARIES thing work?
>>      
> So, yeap, it works, but I expected CMake to clean up after me
> dependency-wise -- instead of (1), this
>
> -llibrarya --llibraryb /usr/local/local/liblapack.a     (1')
>
> would be sufficient. My knowledge on the linking process itself is
> unfortunately not deep enough to tell if that makes an actual
> difference.
>
> Cheers,
> Nico
>    
You could use the CleanLibraryList module I posted a few emails ago: 
just make a list that contains all the libraries you are going to link 
your target against, and then just run clean_library_list on it before 
doing so.

Ryan

-- 
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com/



More information about the CMake mailing list