File cmake-findhdf5-prefer-hl-compilers.patch of Package cmake
From a869b79c5921412c91fb71a761748ae5f7d3fb23 Mon Sep 17 00:00:00 2001
From: Atri Bhattacharya <badshah400@gmail.org>
Date: Mon, 10 Mar 2025 20:55:36 +0530
Subject: [PATCH] FindHDF5: Prefer h5hl* compilers for HDF5_FIND_HL
Prefer `h5hlcc`, `h5hlc++`, and `h5hlfc` compilers when HDF5's HL libraries
are requested. These include the `-lhdf_hl` in the command line, whereas
the non-hl compilers (like `h5cc`) do not. Using the latter, therefore,
leads to cmake complaining about not finding the `HDF5_HL` libraries even
though they are present in the same location as the `hdf5` library itself.
Fixes: #23261
---
Modules/FindHDF5.cmake | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 2f0c3c1665..89058ca2be 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -218,6 +218,13 @@ else()
set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc)
endif()
+# Prefer h5hl<LANG> compilers if HDF5_FIND_HL is enabled
+if(HDF5_FIND_HL)
+ list(PREPEND HDF5_C_COMPILER_NAMES h5hlcc)
+ list(PREPEND HDF5_CXX_COMPILER_NAMES h5hlc++)
+ list(PREPEND HDF5_Fortran_COMPILER_NAMES h5hlfc)
+endif()
+
# Test first if the current compilers automatically wrap HDF5
function(_HDF5_test_regular_compiler_C success version is_parallel)
if(NOT ${success} OR
--
GitLab