[CMake] intercomponent link dependencies?

Nico Schlömer nico.schloemer at gmail.com
Wed Jan 13 07:51:57 EST 2010


> 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


More information about the CMake mailing list