https://bugs.gentoo.org/954378#c14 https://gitlab.kitware.com/cmake/cmake/-/issues/23261 https://gitlab.kitware.com/cmake/cmake/-/commit/a869b79c5921412c91fb71a761748ae5f7d3fb23 From a869b79c5921412c91fb71a761748ae5f7d3fb23 Mon Sep 17 00:00:00 2001 From: Atri Bhattacharya 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 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -218,6 +218,13 @@ else() set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc) endif() +# Prefer h5hl 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