Salome HOME
bos #24363 [CEA 24049] SalomeFindHDF5 does not return HDF5_CXX_LIBRARY
authorvsr <vsr@opencascade.com>
Thu, 3 Jun 2021 16:19:08 +0000 (19:19 +0300)
committervsr <vsr@opencascade.com>
Thu, 3 Jun 2021 16:19:08 +0000 (19:19 +0300)
cmake/FindSalomeHDF5.cmake

index 1a4b27e4ab5728e1778762c3fe928f73b71837be..8f5d51eb131b753beca83463289ef52a8161b156 100644 (file)
@@ -44,10 +44,28 @@ SET(HDF5_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS};${HDF5_INCLUDE_DIR}")
 # Same story with libraries - if in CONFIG mode, HDF5_LIBRARIES is not defined:
 IF(NOT DEFINED HDF5_LIBRARIES)
     IF(TARGET hdf5)
-      SET(HDF5_LIBRARIES hdf5)
+      SET(HDF5_C_LIBRARIES hdf5)
     ELSEIF(TARGET hdf5::hdf5-shared)
-      SET(HDF5_LIBRARIES hdf5::hdf5-shared)
+      SET(HDF5_C_LIBRARIES hdf5::hdf5-shared)
     ENDIF()
+    IF(TARGET hdf5_cpp)
+      SET(HDF5_CXX_LIBRARIES hdf5_cpp)
+    ELSEIF(TARGET hdf5::hdf5-shared)
+      SET(HDF5_CXX_LIBRARIES hdf5::hdf5_cpp-shared)
+    ENDIF()
+    IF(TARGET hdf5_hl)
+      SET(HDF5_C_HL_LIBRARIES hdf5_hl)
+    ELSEIF(TARGET hdf5::hdf5_hl-shared)
+      SET(HDF5_C_HL_LIBRARIES hdf5::hdf5_hl-shared)
+    ENDIF()
+    IF(TARGET hdf5_hl_cpp)
+      SET(HDF5_CXX_HL_LIBRARIES hdf5_hl_cpp)
+    ELSEIF(TARGET hdf5::hdf5_hl_cpp-shared)
+      SET(HDF5_CXX_HL_LIBRARIES hdf5::hdf5_hl_cpp-shared)
+    ENDIF()
+    # Note: now we only set HDF5_LIBRARIES to CXX libraries as it's enough for SALOME.
+    # In future, we probably must list all libraries from requested components.
+    SET(HDF5_LIBRARIES ${HDF5_CXX_LIBRARIES})
 ENDIF()
 
 ##