[CMake] Programs linked to .a or .so libraries?

Convey Christian J NPRI ConveyCJ at Npt.NUWC.Navy.Mil
Tue Aug 28 06:35:44 EDT 2007


> -----Original Message-----
> From: Philip Lowman [mailto:philip at yhbt.com]
> Sent: Tuesday, August 28, 2007 12:15 AM
> To: Convey Christian J NPRI
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Programs linked to .a or .so libraries?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Convey Christian J NPRI wrote:
> > On Linux, I'm building a program that is linked against the
> "ncurses"
> > library. 
> > 
> > In CMake, what decides whether my program will be linked to 
> > libcurses.a or to libcurses.so ?
> > 
> > I'd like to minimize external dependencies in the build 
program, so 
> > whenever possible I'd like to link to the .a version.  But
> if nothing
> > else I need to know which version (static vs. dynamic) of a given 
> > library my program is linked to.
> 
> This is another one of those things that has not been 
implemented in 
> CMake but which has been brought up before.
> Implementing this on UNIX would be easy but I'm not sure on
> Win32 since you couldn't simply rely on file extension to 
determine if 
> it's a static or shared library.
> 
> http://www.cmake.org/Bug/view.php?id=1643
> 
> This workaround may help:
> 
> http://www.cmake.org/pipermail/cmake/2006-September/011096.html

 
Thanks for the info.  What a strange feature for CMake to 
lack!  Does anyone know why this hasn't been implemented?

That is, something like

FIND_LIBRARY(... { STATIC_ONLY | SHARED_ONLY | PREFER_STATIC | PREFER_SHARED
} ...)

and/or

ADD_LINK_LIBRARY(... { STATIC_ONLY | SHARED_ONLY | PREFER_STATIC |
PREFER_SHARED } ...)

?

Thanks,
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4964 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070828/a5b0c011/smime-0001.bin


More information about the CMake mailing list