Fixes in FindHDF5.cmake for Intel Xeon Phi.

Before, -lz -ldl -lm -lrt would be turned into absolute paths. This doesn't work
for the Xeon Phi where we need to cross-compile. The Intel compiler
automatically adds the libraries with the correct architecture as long as -l
arguments are passed as is.
This commit is contained in:
Paul Romano 2015-09-14 10:48:19 +07:00
parent 590df6e62d
commit 13113ca820

View file

@ -292,12 +292,8 @@ if( NOT HDF5_FOUND )
mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR )
list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} )
set( HDF5_${LANGUAGE}_LIBRARY_NAMES
${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT}
${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
# find the HDF5 libraries
foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT} )
if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
@ -325,6 +321,14 @@ if( NOT HDF5_FOUND )
endforeach()
list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
# When the wrapper lists a library with -l, e.g. -lz, simply use it as
# is. If find_library is called for these libraries, you end up with
# local libraries that will not be suitable when cross-compiling for the
# Intel Xeon Phi.
foreach(LIBNAME ${HDF5_${LANGUAGE}_LIBRARY_NAMES})
list(APPEND HDF5_${LANGUAGE}_LIBRARIES "-l${LIBNAME}")
endforeach()
# Append the libraries for this language binding to the list of all
# required libraries.
list(APPEND HDF5_LIBRARIES ${HDF5_${LANGUAGE}_LIBRARIES})