summaryrefslogtreecommitdiffstats
path: root/Modules/FindHDF5.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindHDF5.cmake')
-rw-r--r--Modules/FindHDF5.cmake16
1 files changed, 10 insertions, 6 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 1388aab..8d2a034 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -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()