Salome HOME
Remove trailing white spaces.
[tools/configuration.git] / cmake / FindSalomeHDF5.cmake
index d6d42273f876b24d975ab73b1df6f81850e6a028..16b91ffe56d10ef08365c1c2a98cee223dfe941f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@
 # HDF5 detection for Salome
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
-# 
+#
 # --- HDF5 specificities ----
 #  MPI root directory used for HDF5 compilation is exposed into MPI_ROOT_DIR_EXP
 #
@@ -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_cpp-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()
 
 ##
@@ -72,7 +90,7 @@ IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL)
     SET(_suffix "-shared")
     SET(HDF5_LIBRARIES "${_target_prefix}hdf5${_suffix}")
   ENDIF()
-  GET_PROPERTY(_lib_lst TARGET ${HDF5_LIBRARIES} PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)
+  GET_PROPERTY(_lib_lst SOURCE ${HDF5_LIBRARIES} PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)
   FOREACH(s ${_lib_lst})
     STRING(FIND "${s}" "mpi." _res)   # should cover WIN(?) and LINUX
     IF(_res GREATER -1)
@@ -83,7 +101,7 @@ IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL)
   ENDFOREACH()
   IF(NOT SalomeHDF5_FIND_QUIETLY)
     MESSAGE(STATUS "HDF5 was compiled with MPI: ${MPI_ROOT_DIR_EXP}")
-  ENDIF()  
+  ENDIF()
 ENDIF()
 
 ## Add definitions
@@ -97,7 +115,7 @@ IF(HDF5_IS_PARALLEL AND NOT SALOME_USE_MPI)
    MESSAGE(FATAL_ERROR "HDF5 is compiled with MPI, you have to set SALOME_USE_MPI to ON")
 ENDIF()
 
-IF(HDF5_FOUND) 
+IF(HDF5_FOUND)
   SALOME_ACCUMULATE_HEADERS(HDF5_INCLUDE_DIRS)
   SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${HDF5_LIBRARIES})
 ENDIF()