Salome HOME
CMake: tweaks for Win32 platform: configuration is successful
[modules/kernel.git] / salome_adm / cmake_files / FindSalomeHDF5.cmake
1 # Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 # Author: Adrien Bruneton
20 #
21
22 # HDF5 detection for Salome
23 #
24 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
25
26 # --- HDF5 specificities ----
27 #  MPI root directory used for HDF5 compilation is exposed into MPI_ROOT_DIR_EXP
28 #
29
30 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(HDF5 HDF5_INCLUDE_DIR 1)
31 MARK_AS_ADVANCED(FORCE HDF5_INCLUDE_DIR HDF5_LIB)
32
33 # 7. Expose MPI configuration to the rest of the world
34 IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL)
35   # Set only one reference boolean variable:
36   # (unfortunately what is found in /usr/share/cmake/Modules/FindHDF5.cmake
37   #  and in the native HDF5-config.cmake differ!)
38   SET(HDF5_IS_PARALLEL TRUE)
39
40   # HDF5 was compiled with MPI support
41   # Unfortunately HDF5 doesn't expose its MPI configuration easily ...
42   # We sniff the properties of the HDF5 target which should also be there:
43   GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)
44   FOREACH(s ${_lib_lst})
45     STRING(FIND "${s}" "mpi." _res)   # should cover WIN(?) and LINUX
46     IF(_res GREATER -1)
47       GET_FILENAME_COMPONENT(_tmp "${s}" PATH)     # go up to levels
48       GET_FILENAME_COMPONENT(MPI_ROOT_DIR_EXP "${_tmp}" PATH)
49       BREAK()
50     ENDIF()
51   ENDFOREACH()
52   IF(NOT SalomeHDF5_FIND_QUIETLY)
53     MESSAGE(STATUS "HDF5 was compiled with MPI: ${MPI_ROOT_DIR_EXP}")
54   ENDIF()  
55 ENDIF()
56