[CMake] FindHDF5.cmake patch

Tim Gallagher tim.gallagher at gatech.edu
Thu Mar 17 16:55:11 EDT 2011


Hi, 

Our project uses HDF5 and Fortran, and while I was looking through the comments in the FindHDF5.cmake file, I saw that it doesn't support finding the Fortran bindings. So, I modified it to make it work to find the Fortran bindings. 

Below is the diff output. Let me know if there's a more useful format. This works on the RHEL 5 and openSUSE 11.4 distributions I have access to (although, openSUSE 11.4 messed up the HDF5 build in the repo -- h5fc says the mod file is in /usr/include when it's really in /usr/lib64/gfortran/modules). 

I updated the comments in the file also, and I'm CC'ing the maintainer just in case he misses it on the list.

Thanks,

Tim

tpgLaptop:/usr/share/cmake/Modules # diff FindHDF5.cmake FindHDF5.cmake_orig 
12,14c12,15
< # find the language bindings for the specified components.  The only valid 
< # components are C, CXX, and Fortran.  If the COMPONENTS argument is not
< # given, the module will attempt to find only the C bindings.
---
> # find the language bindings for the specified components.  Currently, the only
> # valid components are C and CXX.  The module does not yet support finding the
> # Fortran bindings.  If the COMPONENTS argument is not given, the module will
> # attempt to find only the C bindings.
35d35
< #  HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
42d41
< #  HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler
67d65
<     Fortran
85,91d82
< find_program( HDF5_Fortran_COMPILER_EXECUTABLE
<     NAMES h5fc h5pfc
<     HINTS ENV HDF5_ROOT
<     PATH_SUFFIXES bin Bin
<     DOC "HDF5 Fortran Wrapper compiler.  Used only to detect HDF5 compile flags." )
< mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE )
< 
170d160
<     _HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
190d179
<     set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran ${HDF5_C_LIBRARY_NAMES_INIT} )
212,218c201
< 	if(${LANGUAGE} STREQUAL "Fortran")
<  	    set(HDF5_INCLUDE_FILENAME hdf5.mod)
<         else()
<  	    set(HDF5_INCLUDE_FILENAME hdf5.h)
< 	endif()
< 
<         find_path( HDF5_${LANGUAGE}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
---
>         find_path( HDF5_${LANGUAGE}_INCLUDE_DIR hdf5.h
340,341c323
<     HDF5_CXX_COMPILER_EXECUTABLE
<     HDF5_Fortran_COMPILER_EXECUTABLE )
---
>     HDF5_CXX_COMPILER_EXECUTABLE )


More information about the CMake mailing list