[CMake] static & shared library

Doug Henry brilligent at gmail.com
Wed Aug 3 11:17:39 EDT 2005


right, but I think static/shared are mutually exclusive. I can't choose 
static and shared, which I can with autotools.


On 8/3/05, William A. Hoffman <billlist at nycap.rr.com> wrote:
> 
> At 08:30 AM 8/3/2005, Doug Henry wrote:
> >thanks. its not a real problem, but if I didn't have to compile twice 
> that would obviously be better :-) Right now I just tack on -static to the 
> target name and have two targets. I'm basically trying to loosely simulate 
> the autotools functionality where you can independently switch on/off shared 
> and static (--disable-shared --enable-static).
> 
> I think you want the BUILD_SHARED_LIBS flag. If you add the libraries 
> without specifying static or
> shared, then the global BUILD_SHARED_LIBS is used instead. This works just 
> like autoconfs --enable-shared
> and --enable-static.
> 
> 
> ADD_LIBRARY: Add an library to the project using the specified source 
> files.
> 
> ADD_LIBRARY(libname [SHARED | STATIC | MODULE]
> source1 source2 ... sourceN)
> 
> Adds a library target. SHARED, STATIC or MODULE keywords are used to set 
> the library type. If the keyword MODULE appears, the library type is set to 
> MH_BUNDLE on systems which use dyld. On systems without dyld, MODULE is 
> treated like SHARED. If no keywords appear as the second argument, the type 
> defaults to the current value of BUILD_SHARED_LIBS. If this variable is not 
> set, the type defaults to STATIC.
> 
> 
> -Bill
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20050803/c310fa65/attachment.htm


More information about the CMake mailing list