1 ############################################################################
3 # Detect MEDFile (med-fichier)
5 # Defines the following variables
6 # MEDFILE_INCLUDE_DIRS - include directories
7 # MEDFILE_LIBRARIES - libraries to link against (C and Fortran)
8 # MEDFILE_C_LIBRARIES - C libraries only
9 # MEDFILE_EXTRA_LIBRARIES - additional libraries
11 # The CMake (or environment) variable MEDFILE_ROOT_DIR can be set to
12 # guide the detection and indicate a root directory to look into.
14 ############################################################################
15 # Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
17 # This library is free software; you can redistribute it and/or
18 # modify it under the terms of the GNU Lesser General Public
19 # License as published by the Free Software Foundation; either
20 # version 2.1 of the License, or (at your option) any later version.
22 # This library is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 # Lesser General Public License for more details.
27 # You should have received a copy of the GNU Lesser General Public
28 # License along with this library; if not, write to the Free Software
29 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
34 MESSAGE(STATUS "Check for medfile ...")
37 SET(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} CACHE PATH "Path to the MEDFile.")
39 LIST(APPEND CMAKE_PREFIX_PATH "${MEDFILE_ROOT_DIR}")
40 ENDIF(MEDFILE_ROOT_DIR)
43 # Detect headers directory
44 FIND_PATH(MEDFILE_INCLUDE_DIRS med.h)
48 SET(MEDFILE_LIBRARIES)
49 SET(MEDFILE_C_LIBRARIES)
50 SET(MEDFILE_EXTRA_LIBRARIES)
52 FIND_LIBRARY(MEDFILE_LIBRARY_medC NAMES medC)
53 IF(MEDFILE_LIBRARY_medC)
54 LIST(APPEND MEDFILE_C_LIBRARIES "${MEDFILE_LIBRARY_medC}")
55 LIST(APPEND MEDFILE_LIBRARIES "${MEDFILE_LIBRARY_medC}")
57 FIND_LIBRARY(MEDFILE_LIBRARY_medfwrap NAMES medfwrap)
58 IF(MEDFILE_LIBRARY_medfwrap)
59 LIST(APPEND MEDFILE_C_LIBRARIES "${MEDFILE_LIBRARY_medfwrap}")
60 LIST(APPEND MEDFILE_LIBRARIES "${MEDFILE_LIBRARY_medfwrap}")
62 FIND_LIBRARY(MEDFILE_LIBRARY_med NAMES med)
63 IF(MEDFILE_LIBRARY_med)
64 LIST(APPEND MEDFILE_LIBRARIES "${MEDFILE_LIBRARY_med}")
66 FIND_LIBRARY(MEDFILE_LIBRARY_medimport NAMES medimport)
67 IF(MEDFILE_LIBRARY_medimport)
68 LIST(APPEND MEDFILE_EXTRA_LIBRARIES "${MEDFILE_LIBRARY_medimport}")
71 INCLUDE(FindPackageHandleStandardArgs)
72 FIND_PACKAGE_HANDLE_STANDARD_ARGS(MEDFile REQUIRED_VARS MEDFILE_INCLUDE_DIRS MEDFILE_LIBRARIES)