Merge pull request #2631 from blattms/dune-2.8-metis
Fix FindMETIS for DUNE 2.8.
This commit is contained in:
@@ -8,7 +8,11 @@
|
||||
# HAVE_METIS - like METIS_FOUND, but for the inclusion in config.h
|
||||
# METIS_INCLUDE_DIRS - incude paths to use libMETIS
|
||||
# METIS_LIBRARIES - Link these to use libMETIS
|
||||
# METIS::METIS - Imported metis target needed for DUNE 2.8.0
|
||||
# METIS_API_VERSION - The METIS api version scotch is supporting.
|
||||
|
||||
set(METIS_API_VERSION 0 CACHE STRING
|
||||
"METIS API version provided by METIS or scotch-metis library")
|
||||
set(METIS_SEARCH_PATH "/usr" "/usr/local" "/opt" "/opt/local")
|
||||
set(METIS_NO_DEFAULT_PATH "")
|
||||
if(METIS_ROOT)
|
||||
@@ -35,9 +39,27 @@ find_library(METIS_LIBRARIES
|
||||
${METIS_NO_DEFAULT_PATH})
|
||||
|
||||
set (METIS_FOUND FALSE)
|
||||
|
||||
if (METIS_INCLUDE_DIRS OR METIS_LIBRARIES)
|
||||
set(METIS_FOUND TRUE)
|
||||
set(HAVE_METIS TRUE)
|
||||
file(READ "${METIS_INCLUDE_DIRS}/metis.h" metisheader)
|
||||
string(REGEX MATCH "#define METIS_VER_MAJOR[ ]+([0-9]+)" METIS_MAJOR_VERSION ${metisheader})
|
||||
if(NOT METIS_API_VERSION AND METIS_MAJOR_VERSION)
|
||||
# string(REGEX REPLACE ".*#define METIS_VER_MAJOR[ ]+([0-9]+).*" "\\1"
|
||||
# METIS_MAJOR_VERSION "${metisheader}")
|
||||
if(METIS_MAJOR_VERSION GREATER_EQUAL 3 AND METIS_MAJOR_VERSION LESS 5)
|
||||
set(METIS_API_VERSION "3")
|
||||
else()
|
||||
set(METIS_API_VERSION "${METIS_MAJOR_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(METIS::METIS UNKNOWN IMPORTED)
|
||||
set_target_properties(METIS::METIS PROPERTIES
|
||||
IMPORTED_LOCATION ${METIS_LIBRARIES}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${METIS_INCLUDE_DIRS}
|
||||
INTERFACE_COMPILE_DEFINITIONS METIS_API_VERSION=${METIS_API_VERSION})
|
||||
endif()
|
||||
|
||||
# print a message to indicate status of this package
|
||||
|
||||
Reference in New Issue
Block a user