[CMake] Linking Behavior of Static Libraries on Windows

Filipe Sousa natros at gmail.com
Thu Mar 22 13:37:06 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bpwlist at cox.net wrote:
> Part of my objection is that I want to limit how many in which libraries I have to distribute.
> 
> My project looks some thing like this:
> 
> main_src/
>       main_exe (depends on main_shared_library)
>       main_shared_library (depends on my_static_library_facade)
>       my_static_library_facade
>                   3rd party library dependencies
> 
> plugin
>      my_plugin_shared_library (depends on main_shared library)
> 
> I have the majority of my main source code in a seperate library to allow me to link my plugins as dexribed in this thread: http://www.mail-archive.com/cmake@cmake.org/msg02810.html
> 
> I do not have direct control over the 3rd party libraries and there are also so some dependency problems which made me want to isolate those libraries.  So I wrote a facade library.
> 
> The plugin is an example to users of my application on how to extend my applications functionality.
> 
> I would like to just be able to distribute the main_exe, the plugin example, and the main shared library (to allow users to link the plugin).
> 
> Under cmake this is what currently happens:
> 
> - my_static_library_facade compiles, doesn't link 3rd party dependencies.
> - main_shared_library compiles, links my_static_library, 3rd party libraries
> - main_exe compiles, links my_shared_library, my_static_library, 3rd party  libraries
> - plugin compiles,  links my_shared_library, my_static_library, 3rd party  libraries
> 
> My preference would be for the 3rd party libs to be linked when the facade library is created.  But even given that that can't happen under cmake, cmake unneccessarily links the libraries again when main_exe and the plugin is compiled.  This creates a unnecessary chain of dependencies.

This is a topic that has been discussed several times. Try searching for
 "convenience libraries",

- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGAszSbQdNYqwwwCwRAh/sAJ9tjYn+Mp5h0eHH3MSJxLABLqiUJgCeOFJj
jQ0TcwoEo3g/uiPUaTfw710=
=Ug5x
-----END PGP SIGNATURE-----


More information about the CMake mailing list