summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKris Thielemans <kris.f.thielemans@hotmail.com>2017-02-06 01:27:56 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-01 13:11:22 (GMT)
commitbf67fff0356f1d0d6996a52eb6fda2358b17b57c (patch)
tree5225971e9630c86b6aee4f0d324f252a02a53e33
parente629be4a7affe8615c2321b1a08bebb42bb81b15 (diff)
downloadCMake-bf67fff0356f1d0d6996a52eb6fda2358b17b57c.zip
CMake-bf67fff0356f1d0d6996a52eb6fda2358b17b57c.tar.gz
CMake-bf67fff0356f1d0d6996a52eb6fda2358b17b57c.tar.bz2
FindHDF5: recognize hdf5:: prefix when using hdf5-config.cmake
Some versions of HDF5 use this prefix on their imported targets.
-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()