From 3342bd923d45d244db08715a743fd1ad488b8481 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 12 Aug 2025 16:06:52 +0500 Subject: [PATCH] cmake - detect missing HDF5_LIBRARIES on win/darwin Previously it would assign .so files on Windows as libraries and you would detect error on linking stage. --- cmake/CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9936d721b4..e3ee802708 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -654,14 +654,18 @@ if(HDF5_SUPPORT) endif() if(NOT HDF5_LIBRARIES) - # debian default - set(HDF5_LIBRARIES - /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so - /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so - /usr/lib/x86_64-linux-gnu/libsz.so - /usr/lib/x86_64-linux-gnu/libaec.so - z dl - ) + if(NOT WIN32 AND NOT APPLE) + # debian default + set(HDF5_LIBRARIES + /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so + /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so + /usr/lib/x86_64-linux-gnu/libsz.so + /usr/lib/x86_64-linux-gnu/libaec.so + z dl + ) + else() + message(FATAL_ERROR "HDF5_LIBRARIES is not provided.") + endif() endif() add_definitions(-DWITH_HDF5)