[CMake] how to select static libraries for linking?

Eric Jonas jonas at MIT.EDU
Thu Jun 11 18:57:37 EDT 2009


On Thu, 2009-06-11 at 16:49 -0600, James C. Sutherland wrote:
> I have an executable that links with HDF5 (by the way, is there any  
> plan to create a "FindHDF5.cmake" file?).
> The problem is that I have two flavors of libraries:
> 	libhdf5_cpp.a		libhdf5.a
> 	libhdf5_cpp.dylib	libhdf5.dylib
> When I do
>    set( HDF5_LIBRARIES hdf5_cpp hdf5 )
> it seems that CMake ends up choosing the *.dylib rather than the *.a  
> versions.  Is there a way to fix this so that I link statically?
> 


James, I don't have a specific answer to your question, but I've taken
some preliminary examples of a FindHDF5.cmake from on the net and
extended it here: 

http://github.com/somaproject/recorder/tree/07b676c771cc3f389d6e4a4bee1dd05b0c7f48d9/CMake

I'd be interested in extending this to, for example, more directly
support static lib selection as you suggest. I'm a bit new to CMake, so
I'm sure my .cmake is not great, but it might be a good starting point? 

			...Eric



More information about the CMake mailing list