complex situation: Re: [Cmake] how to find STATIC library, ignore
DYNAMIC library
Brad King
brad.king at kitware.com
Thu Aug 19 14:01:31 EDT 2004
Liwei Peng wrote:
> 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.
As a temporary solution you can create a symlink for the static library
yourself:
IF(UNIX)
EXEC_PROGRAM(ln ARGS -sf "${HDF5_LIBRARY}"
"${PROJECT_BINARY_DIR}/libmyhdf5.a")
ENDIF(UNIX)
Then include PROJECT_BINARY_DIR in the LINK_DIRECTORIES and link to
myhdf5 instead. This way the linker will only be able to pick up the
static version. I have not tried this, though.
-Brad
More information about the Cmake
mailing list