FindHDF5: recognize hdf5:: prefix when using hdf5-config.cmake

Some versions of HDF5 use this prefix on their imported targets.
This commit is contained in:
Kris Thielemans authored and Brad King committed 2017-03-01 08:11:22 -05:00
1 parent e629be4a7a
commit bf67fff035
1 file changed
+10 -6
+10 -6
View File
@@ -404,12 +404,16 @@ if(NOT HDF5_FOUND)
set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
set(HDF5_LIBRARIES)
set(HDF5_C_TARGET hdf5)
set(HDF5_C_HL_TARGET hdf5_hl)
set(HDF5_CXX_TARGET hdf5_cpp)
set(HDF5_CXX_HL_TARGET hdf5_hl_cpp)
set(HDF5_Fortran_TARGET hdf5_fortran)
set(HDF5_Fortran_HL_TARGET hdf5_hl_fortran)
if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared)
# Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc
set(_target_prefix "hdf5::")
endif()
set(HDF5_C_TARGET ${_target_prefix}hdf5)
set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl)
set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp)
set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp)
set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran)
set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran)
if(HDF5_USE_STATIC_LIBRARIES)
set(_suffix "-static")
else()