/**
* @file FindMETIS.cmake
*
* @brief
*
* @copyright
* Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* SPC (Swiss Plasma Center)
*
* spclibs is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* @authors
* (in alphabetical order)
* @author Nicolas Richart
*/
find_path(METIS_INCLUDE_DIR metis.h
PATHS "${METIS_DIR}"
ENV METIS_DIR
PATH_SUFFIXES include
)
find_library(METIS_LIBRARY NAMES metis
PATHS "${METIS_DIR}"
ENV METIS_DIR
PATH_SUFFIXES lib
)
mark_as_advanced(METIS_LIBRARY METIS_INCLUDE_DIR)
#===============================================================================
include(FindPackageHandleStandardArgs)
if(CMAKE_VERSION VERSION_GREATER 2.8.12)
if(METIS_INCLUDE_DIR)
file(STRINGS ${METIS_INCLUDE_DIR}/metis.h _versions
REGEX "^#define\ +METIS_VER_(MAJOR|MINOR|SUBMINOR) .*")
foreach(_ver ${_versions})
string(REGEX MATCH "METIS_VER_(MAJOR|MINOR|SUBMINOR) *([0-9.]+)" _tmp "${_ver}")
set(_metis_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
endforeach()
set(METIS_VERSION "${_metis_MAJOR}.${_metis_MINOR}" CACHE INTERNAL "")
endif()
find_package_handle_standard_args(METIS
REQUIRED_VARS
METIS_LIBRARY
METIS_INCLUDE_DIR
VERSION_VAR
METIS_VERSION)
else()
find_package_handle_standard_args(METIS DEFAULT_MSG
METIS_LIBRARY METIS_INCLUDE_DIR)
endif()