From 186b0f813132d79b0cb5412e902478aa5f5795ea Mon Sep 17 00:00:00 2001
From: Kris Thielemans <k.thielemans@ucl.ac.uk>
Date: Sun, 10 Jan 2021 10:04:34 +0000
Subject: FindHDF5: correct and describe list of imported target

---
 Modules/FindHDF5.cmake | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 05696ae..9bb4166 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -116,15 +116,22 @@ also be defined.  With all components enabled, the following variables will be d
 
 With all components enabled, the following targets will be defined:
 
-::
-
-  ``hdf5::hdf5``
-  ``hdf5::hdf5_hl_cpp``
-  ``hdf5::hdf5_fortran``
-  ``hdf5::hdf5_hl``
-  ``hdf5::hdf5_hl_cpp``
-  ``hdf5::hdf5_hl_fortran``
-  ``hdf5::h5diff``
+``HDF5::HDF5``
+  All detected ``HDF5_LIBRARIES``.
+``hdf5::hdf5``
+  C library.
+``hdf5::hdf5_cpp``
+  C++ library.
+``hdf5::hdf5_fortran``
+  Fortran library.
+``hdf5::hdf5_hl``
+  High-level C library.
+``hdf5::hdf5_hl_cpp``
+  High-level C++ library.
+``hdf5::hdf5_hl_fortran``
+  High-level Fortran library.
+``hdf5::h5diff``
+  ``h5diff`` executable.
 
 Hints
 ^^^^^
-- 
cgit v0.12


From eec3b775a7db2955ed8c2e6e8f21eb900c5e1c79 Mon Sep 17 00:00:00 2001
From: Kris Thielemans <k.thielemans@ucl.ac.uk>
Date: Sun, 10 Jan 2021 11:29:28 +0000
Subject: FindHDF5: List imported targets in debug output

If HDF5_FIND_DEBUG, list all targets that are defined
(from either FindHDF5.cmake or the hdf5-config.cmake).
---
 Modules/FindHDF5.cmake | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 9bb4166..f64f72f 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -1154,6 +1154,21 @@ if (HDF5_FIND_DEBUG)
     message(STATUS "HDF5_${_lang}_HL_LIBRARY: ${HDF5_${_lang}_HL_LIBRARY}")
     message(STATUS "HDF5_${_lang}_HL_LIBRARIES: ${HDF5_${_lang}_HL_LIBRARIES}")
   endforeach()
+  message(STATUS "Defined targets (if any):")
+  foreach(_lang IN  ITEMS "" "_cpp" "_fortran")
+    foreach(_hl IN  ITEMS "" "_hl")
+      foreach(_prefix IN ITEMS "hdf5::" "")
+        foreach(_suffix IN ITEMS "-static" "-shared" "")
+          set (_target ${_prefix}hdf5${_hl}${_lang}${_suffix})
+          if (TARGET  ${_target})
+            message(STATUS "... ${_target}")
+          else()
+            #message(STATUS "... ${_target} does not exist")
+          endif()
+        endforeach()
+      endforeach()
+    endforeach()
+  endforeach()
 endif()
 unset(_lang)
 unset(_HDF5_NEED_TO_SEARCH)
-- 
cgit v0.12