[CMake] intercomponent link dependencies?

Michael Wild themiwi at gmail.com
Fri Jan 8 04:33:26 EST 2010


On 8. Jan, 2010, at 10:20 , Marcel Loose wrote:

> Hi Nico,
> 
> I think you should put the knowledge of the intercomponent link
> dependencies in your FindXXX script. That way, you don't have to bother
> the user of this third-party package with this knowledge.
> 
> BTW, if you're on Linux and your package contains shared libraries,
> instead of static libraries, then, iff the package was properly built
> (i.e. with the dependencies linked into the shared libs) you won't need
> to specify these indirect dependencies.
> 
> Best regards,
> Marcel Loose.

Again, this is very difficult to do. Depending on HOW the static library was built (i.e. which optional parts have been enabled) the transitive link dependencies change. E.g. if you have libcurl.a you need to find out whether that thing has been compiled against OpenSSL, GnuTLS or Mozilla NSS or no SSL implementation at all. Good luck with that... And then on Windows you currently can't determine whether that .lib file is a link-library (i.e. used to link against a .dll) or actually a static library.

And if you just throw them in for good measure, you run into over-linking issues: http://wiki.mandriva.com/en/Overlinking

Static linking is and will always be a mess (unless all projects install a CMake-file containing the appropriate add_library(XXX IMPORTED) and IMPORTED_LINK_INTERFACE_LIBRARIES stanzas, or CMake learns to use libtool .la files and all projects create them and write them correctly).

Just my 2c.

Michael




More information about the CMake mailing list