[CMake] Linking shared libraries into one single executable?

Hendrik Sattler post at hendrik-sattler.de
Mon Aug 13 12:59:13 EDT 2007


Am Montag 13 August 2007 18:25 schrieb Alexander Lex:
> I'm not so savy with build systems and libraries etc, so please excuse
> if I'm asking a couple of stupid questions:
>
> I have a project, managed by cmake, which uses a couple of external
> libraries (Coin3D, SoQt, Qt4, ITK, SimVoleon, Boost).
>
> My project builds fine using the shared installed libraries.
>
> Now I'd like to put a releas on sourceforge, for both windows and linux,
> but I can't expect people to have all those libraries installed. Most of
> them are not managed by package management systems, and some are only
> available as source files. I can not expect a potential user to compile
> those libraries - so I need a way to include all the needed stuff in my
> program. I honestly have no idea how to do that, so any pointers would
> be much appreciated!

OTOH, you waste memory available to your users even if they have those libs 
installed as shared libs.
I suggest shipping the shared libs in an _additional_ package. In Windows, 
those .dll files can be simply dropped to the same directory as the 
executable. Under Linux, the libs can be dropped to either a standard library 
path or LD_LIBRARY_PREFIX can be defined to the proper directory (then 
starting the app with a one-liner shell script).
Since this is so simple, you should really avoid a static linking of your 
binary, thus making the life of your users easier.

HS


More information about the CMake mailing list