1 # Copyright (C) 2010-2012 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Find the MED includes and library
23 # MED3HOME, a directory where MED was installed. This directory is used to help find trhe other values.
24 # MED_INCLUDE_DIR, where to find med.h
25 # MED_INCLUDE_DIRS, where to find med.h file, concatenated with other include dirs from HDF5 and MPI (if parallel)
26 # MED_LIBRARIES, libraries to link against to use MED. (including HDF5 and MPI if parallel)
27 # MED_FOUND, If false, do not try to use MED.
28 # also defined, but not for general use are
29 # MED_LIBRARY, the med library.
30 # MEDC_LIBRARY, the medC library
32 SET(MED3HOME $ENV{MED3HOME} CACHE PATH "Path to the med install dir")
35 FIND_PROGRAM(MDUMP mdump)
37 SET(MED3HOME ${MDUMP})
38 GET_FILENAME_COMPONENT(MED3HOME ${MED3HOME} PATH)
39 GET_FILENAME_COMPONENT(MED3HOME ${MED3HOME} PATH)
43 FIND_PATH(MED_INCLUDE_DIR med.h
51 FIND_LIBRARY(MED_LIBRARY med
53 ${MED_INCLUDE_DIR}/../lib
60 FIND_LIBRARY(MEDC_LIBRARY medC
69 get_filename_component(MED_LIBRARY_DIR ${MEDC_LIBRARY} PATH)
73 SET(MED_LIBRARIES ${MEDC_LIBRARY} )
75 SET(MED_LIBRARIES ${MED_LIBRARIES} ${MED_LIBRARY} )
77 SET( MED_FOUND "YES" )
79 ENDIF(MED_INCLUDE_DIR)
83 SET(MED_LIBRARIES ${MED_LIBRARIES} ${HDF5_LIBS})
84 SET(MED_INCLUDE_DIRS ${MED_INCLUDE_DIR} ${HDF5_INCLUDE_DIR})
86 FIND_PACKAGE(HDF5 REQUIRED)
87 SET(MED_LIBRARIES ${MED_LIBRARIES} ${HDF5_LIBRARIES})
88 SET(MED_INCLUDE_DIRS ${MED_INCLUDE_DIR} ${HDF5_INCLUDE_DIRS})
89 IF(${HDF5_IS_PARALLEL})
90 FIND_PACKAGE(MPI REQUIRED)
91 SET(MED_LIBRARIES ${MED_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
92 SET(MED_INCLUDE_DIRS ${MED_INCLUDE_DIRS} ${MPI_INCLUDE_PATH})
93 ENDIF(${HDF5_IS_PARALLEL})
97 SET(MED_INCLUDE_DIR ${MED_INCLUDE_DIRS})