hdf5-1.8.8/9 fail to build shared with fortran on Linux with cmake-2.8.8

Had to upgrade cmake to 2.8.8 for another project (VisIT). Now the shared
configuration

cmake \
-DCMAKE_INSTALL_PREFIX:PATH=/scr_multipole/cary/contrib/hdf5-1.8.8-ser \
   -DCMAKE_BUILD_TYPE:STRING=Release \
   -DCMAKE_COLOR_MAKEFILE:BOOL=FALSE \
   -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
   -DCMAKE_C_COMPILER:FILEPATH='/usr/local/contrib/bin/gcc' \
   -DCMAKE_CXX_COMPILER:FILEPATH='/usr/local/contrib/bin/g++' \
-DCMAKE_Fortran_COMPILER:FILEPATH='/usr/local/contrib/bin/gfortran' \
   -DCMAKE_C_FLAGS:STRING='-pipe -fPIC' \
   -DCMAKE_CXX_FLAGS:STRING='-pipe -fPIC' \
   -DCMAKE_Fortran_FLAGS:STRING='-fPIC' \
   -DBUILD_SHARED_LIBS:BOOL=ON \
   -DCMAKE_SHARED_LINKER_FLAGS:STRING='-Wl,-rpath,$ORIGIN' \
   -DCMAKE_SKIP_RPATH:BOOL=ON \
   -DHDF5_BUILD_FORTRAN:BOOL=ON \
-DCMAKE_EXE_LINKER_FLAGS:STRING='-Wl,-rpath,/usr/local/contrib/gcc-4.6.3/lib64' \
   -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=TRUE \
   -DHDF5_BUILD_HL_LIB:BOOL=ON \
   /scr_multipole/cary/vorpalall/builds/hdf5-1.8.8

does not build on a Linux machine,

$ uname -a; gcc --version
Linux multipole.txcorp.com 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
gcc (GCC) 4.6.3

The failure is

Linking C shared library ../../bin/libhdf5_f90cstub.so
cd /scr_multipole/cary/vorpalall/builds/hdf5-1.8.8/sersh/fortran/src && /scr_multipole/cary/contrib/cmake-2.8.8-ser/bin/cmake -E cmake_link_script CMakeFiles/hdf5_f90cstub.dir/link.txt --verbose=1
/usr/local/contrib/bin/gcc -fPIC -pipe -fPIC -std=c99 -fomit-frame-pointer -finline-functions -fno-common -fmessage-length=0 -O3 -DNDEBUG -Wl,-rpath,$ORIGIN -shared -Wl,-soname,libhdf5_f90cstub.so.7.2.0 -o ../../bin/libhdf5_f90cstub.so.1.8.8 CMakeFiles/hdf5_f90cstub.dir/__/H5f90i_gen.h.o CMakeFiles/hdf5_f90cstub.dir/H5f90kit.c.o CMakeFiles/hdf5_f90cstub.dir/H5_f.c.o CMakeFiles/hdf5_f90cstub.dir/H5Af.c.o CMakeFiles/hdf5_f90cstub.dir/H5Df.c.o CMakeFiles/hdf5_f90cstub.dir/H5Ef.c.o CMakeFiles/hdf5_f90cstub.dir/H5Ff.c.o CMakeFiles/hdf5_f90cstub.dir/H5Gf.c.o CMakeFiles/hdf5_f90cstub.dir/H5If.c.o CMakeFiles/hdf5_f90cstub.dir/H5Lf.c.o CMakeFiles/hdf5_f90cstub.dir/H5Of.c.o CMakeFiles/hdf5_f90cstub.dir/H5Pf.c.o CMakeFiles/hdf5_f90cstub.dir/H5Rf.c.o CMakeFiles/hdf5_f90cstub.dir/H5Sf.c.o CMakeFiles/hdf5_f90cstub.dir/H5Tf.c.o CMakeFiles/hdf5_f90cstub.dir/H5Zf.c.o ../../bin/libhdf5.so.1.8.8 -lm
CMakeFiles/hdf5_f90cstub.dir/__/H5f90i_gen.h.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[2]: *** [bin/libhdf5_f90cstub.so.1.8.8] Error 1

Seems like the new cmake does not allow one to put header files in the library
source list.

Attached is the patch that allowed me to build hdf5-1.8.9 everywhere I need.

John Cary

hdf5-1.8.9.patch (33.5 KB)