[Cmake] RE: cmake RFC

Phil Pritchett p.pritchett at 2d3.com
Wed May 1 08:34:59 EDT 2002


> -----Original Message-----
> From: William A. Hoffman [mailto:bill.hoffman at kitware.com]
> > > 2) A typical release build will require some libraries to be
> > > linked statically (vxl,libstdc++) and others dynamically
> > > (GL,X,libm,libc). Apart from the linker flags being wrong,
> > > there is no mechanism for this split into "local" and
> > > "system" libraries. Consequently, hand-editing of link-lines
> > > is necessary to make release builds.
> > >
> 
> I am not sure how to fix this.  Do you have any suggestions?
> For releases here, I usually create a directory with symbolic 
> links to the 
> static
> libraries I need to link, and add that to the link path.   I 
> guess you can
> do -static -shared around libraries.  What do you suggest?
> 

Couldn't this be fixed by having an option in LINK_LIBRARIES to specify
whether linkage should be static or dynamic; then, as you suggest, prefixing
the two groups of libraries with -static and -shared flags. 


> > > 3) The c++ compiler is used as the linker, meaning that
> > > libstdc++ is always linked dynamically, which is bad.
> > >
> 
> This is required for C++ code.  If you do not use C++ for the 
> linker, global
> constructors are not called properly.

As far as I know when you link via c++ you are just calling ld and
specifying
some additional objects that are used to deal with global constructors
(crtbegin.o  and crtend.o) and other auxilary object files. 

Cheers,
Phil



More information about the CMake mailing list