1 # Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
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, or (at your option) any later version.
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
22 MESSAGE(STATUS "Check for metis ...")
24 SET(METIS_ROOT_DIR $ENV{METIS_ROOT_DIR} CACHE PATH "Path to the METIS.")
26 LIST(APPEND CMAKE_LIBRARY_PATH "${METIS_ROOT_DIR}")
27 LIST(APPEND CMAKE_LIBRARY_PATH "${METIS_ROOT_DIR}/lib")
28 LIST(APPEND CMAKE_INCLUDE_PATH "${METIS_ROOT_DIR}/Lib")
29 LIST(APPEND CMAKE_INCLUDE_PATH "${METIS_ROOT_DIR}/include")
32 FIND_LIBRARY(METIS_LIBRARIES metis)
33 FIND_PATH(METIS_INCLUDE_DIRS metis.h)
35 INCLUDE(FindPackageHandleStandardArgs)
36 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Metis REQUIRED_VARS METIS_INCLUDE_DIRS METIS_LIBRARIES)
37 FILE(READ ${METIS_INCLUDE_DIRS}/metis.h metis_h_content)
38 STRING(REPLACE "\n" ";" list_metis_h_content ${metis_h_content})
39 FOREACH(ln ${list_metis_h_content})
40 IF("${ln}" MATCHES "^#define METIS_VER_MAJOR")
41 STRING(REPLACE "#define METIS_VER_MAJOR" "" metis_major_version "${ln}")
42 STRING(STRIP "${metis_major_version}" metis_major_version)
43 ENDIF("${ln}" MATCHES "^#define METIS_VER_MAJOR")
44 ENDFOREACH(ln ${list_metis_h_content})
45 IF(metis_major_version STREQUAL 5)
46 SET(SALOME_MED_METIS_V5 1)
47 MESSAGE(STATUS "Metis maj version 5 detected.")
48 ELSE(metis_major_version STREQUAL 5)
49 MESSAGE(STATUS "Metis maj version 4 detected.")
50 ENDIF(metis_major_version STREQUAL 5)