Files
cmake/cmake-findhdf5-prefer-hl-compilers.patch
Dirk Mueller d2ccc3eb93 Accepting request 1252062 from home:badshah400:hdf5-update
Add cmake-findhdf5-prefer-hl-compilers.patch -- FindHDF5: Prefer h5hl* compilers for HDF5_FIND_HL; patch submitted upstream [https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10450.patch].  This fixes hdf5_hl detection issues when building hdf5 >= 1.14 using cmake instead of autotools.

OBS-URL: https://build.opensuse.org/request/show/1252062
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=623
2025-03-12 14:12:39 +00:00

39 lines
1.3 KiB
Diff

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