/usr/share/dune/cmake/modules/FindMETIS.cmake is in libdune-common-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | # Accepts the following variables:
#
# METIS_ROOT: Prefix where METIS is installed.
# METIS_LIB_NAME: Name of the METIS library (default: metis).
# METIS_LIBRARY: Full path of the METIS library.
# Sets the following variables:
#
# METIS_LIBRARY: Full path of the METIS library.
# METIS_FOUND: True if ParMETIS was found.
# METIS_LIBRARIES: List of all libraries needed for linking with METIS,
#
# Provides the following macros:
#
# find_package(METIS)
#
# Searches for METIS (See above)
# search metis header
find_path(METIS_INCLUDE_DIR metis.h
PATHS ${METIS_DIR} ${METIS_ROOT}
PATH_SUFFIXES metis include include/metis Lib METISLib
NO_DEFAULT_PATH
DOC "Include directory of metis")
find_path(METIS_INCLUDE_DIR metis.h
PATH_SUFFIXES metis include include/metis Lib METISLib)
set(METIS_LIBRARY METIS_LIBRARY-NOTFOUND CACHE FILEPATH "Full path of the METIS library")
# check metis header
include(CMakePushCheckState)
cmake_push_check_state() # Save variables
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${METIS_INCLUDE_DIR})
check_include_file(metis.h METIS_FOUND)
# search metis library
if(NOT METIS_LIB_NAME)
set(METIS_LIB_NAME metis)
endif(NOT METIS_LIB_NAME)
find_library(METIS_LIBRARY ${METIS_LIB_NAME}
PATHS ${METIS_DIR} ${METIS_ROOT}
PATH_SUFFIXES lib
NO_DEFAULT_PATH)
find_library(METIS_LIBRARY ${METIS_LIB_NAME}
PATH_SUFFIXES lib
)
# check metis library
if(METIS_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${METIS_LIBRARIY})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${METIS_LIBRARY})
include(CheckSymbolExists)
check_function_exists(METIS_PartGraphKway HAVE_METIS_PARTGRAPHKWAY)
endif(METIS_LIBRARY)
# behave like a CMake module is supposed to behave
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
"METIS"
DEFAULT_MSG
METIS_INCLUDE_DIR
METIS_LIBRARY
HAVE_METIS_PARTGRAPHKWAY
)
cmake_pop_check_state()
mark_as_advanced(METIS_INCLUDE_DIR METIS_LIBRARIES METIS_LIB_NAME)
# if both headers and library are found, store results
if(METIS_FOUND)
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
set(METIS_LIBRARIES ${METIS_LIBRARY})
set(HAVE_METIS ${METIS_FOUND})
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determing location of METIS succeded:\n"
"Include directory: ${METIS_INCLUDE_DIRS}\n"
"Library directory: ${METIS_LIBRARIES}\n\n")
else(METIS_FOUND)
# log errornous result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determing location of METIS failed:\n"
"Include directory: ${METIS_INCLUDE_DIRS}\n"
"Library directory: ${METIS_LIBRARIES}\n\n")
endif(METIS_FOUND)
#add all metis related flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_metis_flags
if(METIS_FOUND)
foreach(dir ${METIS_INCLUDE_DIRS})
set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}")
endforeach()
endif()
|