complex situation: Re: [Cmake] how to find STATIC library, ignore DYNAMIC library

Liwei Peng liwei_peng at yahoo.com
Thu Aug 19 13:23:50 EDT 2004


Hi Brand,

thanks for your quick response. 

My situation is a little bit complex. 
1) My program needs to link about 5 libraries
including HDF. while I want to have HDF statically
linked, for the other 4 libraries, I want them to be
dynamically linked.

2) The program is being ported to multiple platforms
including linux, sgi, ibm aix, sun solaris, even
windows. so a platform-specific flag may not be easy
to do by myself. if CMake provides this flag, that'll
be great.

Thanks,

Liwei


--- Brad King <brad.king at kitware.com> wrote:

> Liwei Peng wrote:
> > I am a CMake user for a long time. Recently I have
> a
> > problem in using CMake to find the right library.
> 
> This has been a common problem due to unix linker
> limitations.  I have 
> some ideas on how to fix it which I've documented in
> this feature request:
> 
> http://www.cmake.org/Bug/bug.php?op=show&bugid=1105
> 
> > In my program, I need to link HDF library. In my
> > computer, there are both HDF dynamic
> > library(libhdf5.so) and HDF static
> library(libhdf5.a)
> > installed under /usr/lib. I want to link the
> static
> > library. but CMake always go to the dynamic
> library.
> > Is there any way in CMake that I can force it to
> use
> > static instead of dynamic?
> 
> This can be fixed on a per-platform basis by
> including the proper linker 
> flag in your CMAKE_EXE_LINKER_FLAGS variable.  I
> think adding something 
> like -Bstatic will tell the linker to use only
> static libraries.  You 
> will have to read the documentation for your linker
> to find the proper flag.
> 
> -Brad
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Cmake mailing list