[CMake] [New Module] FindHDF5.cmake

James C. Sutherland James.Sutherland at utah.edu
Fri Aug 28 12:54:01 EDT 2009


> I have a question about the static library option.  I did:
> 	set( HDF5_USE_STATIC_LIBRARIES 1 )
>
> which should trigger linkage with static libraries, right?  But what  
> I see in the link line is:
>
>> /usr/lib/libz.dylib /usr/lib/libm.dylib /jcs/apps/hdf5_serial/lib/ 
>> libhdf5_cpp.dylib /usr/lib/libz.dylib /usr/lib/libm.dylib /jcs/apps/ 
>> hdf5_serial/lib/libhdf5_cpp.dylib
>
Okay - it appears that was due to an out of date cache.  It now tries  
to link static HDF5 libraries, but is still trying to link dynamic "z"  
and "m" libraries:
>
> /usr/lib/libm.dylib /jcs/apps/hdf5_serial/lib/libhdf5_cpp.a /usr/lib/ 
> libz.dylib /usr/lib/libm.dylib /jcs/apps/hdf5_serial/lib/libhdf5_cpp.a

>

Previously, I was adding these via
	target_link_libraries( ... z )

Are these two equivalent?


One other question: if one requests the "CXX" component for HDF5, the  
hdf5_cpp library is linked in, but the hdf5 library is also required.   
Adding "C" and "CXX" as components fixes this problem.  Perhaps the  
FindHDF5.cmake file could automatically activate "C" if "CXX" is  
requested?  That might be more robust...

Thanks again for the contribution!

James


More information about the CMake mailing list