Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Koch
dune-common
Commits
e11c1e30
Commit
e11c1e30
authored
12 years ago
by
Christoph Grüninger
Browse files
Options
Downloads
Patches
Plain Diff
[FindMETIS.cmake]
Improve METIS test, tested with versions 4.0.3 and 5.0.2. [[Imported from SVN: r7035]]
parent
b5e05207
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/modules/FindMETIS.cmake
+58
-22
58 additions, 22 deletions
cmake/modules/FindMETIS.cmake
with
58 additions
and
22 deletions
cmake/modules/FindMETIS.cmake
+
58
−
22
View file @
e11c1e30
...
...
@@ -21,45 +21,81 @@
#
# Adds the necessary flags to comile and link TARGETS with ParMETIS support.
#
find_path
(
METIS_INCLUDE_DIRS metis.h PATHS
${
METIS_DIR
}
PATH_SUFFIXES metis NO_DEFAULT_PATH
# function to add the metis flags to a target
function
(
add_dune_metis_flags _targets
)
if
(
METIS_FOUND
)
foreach
(
_target
${
_targets
}
)
target_link_libraries
(
${
_target
}
${
METIS_LIBRARY
}
)
endforeach
(
_target
${
_targets
}
)
set_property
(
TARGET
${
_targets
}
APPEND PROPERTIES
COMPILE_DIRECTORIES
${
METIS_INCLUDE_DIR
}
)
endif
(
METIS_FOUND
)
endfunction
(
add_dune_metis_flags _targets
)
# search metis header
find_path
(
METIS_INCLUDE_DIR metis.h
PATHS
${
METIS_DIR
}
PATH_SUFFIXES metis include Lib
NO_DEFAULT_PATH
DOC
"Include directory of metis"
)
find_path
(
METIS_INCLUDE_DIRS metis.h PATH_SUFFIXES metis
)
find_path
(
METIS_INCLUDE_DIR metis.h
PATH_SUFFIXES metis inclue Lib
)
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
S
}
)
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
${
ParMETIS_DIR
}
PATH_SUFFIXES lib NO_DEFAULT_PATH
)
find_library
(
METIS_LIBRARY
${
METIS_LIB_NAME
}
)
find_library
(
METIS_LIBRARY
${
METIS_LIB_NAME
}
PATHS
${
METIS_DIR
}
PATH_SUFFIXES lib
NO_DEFAULT_PATH
)
find_library
(
METIS_LIBRARY
${
METIS_LIB_NAME
}
PATH_SUFFIXES lib
)
# behave like a CMake module is supposed to behave
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
"METIS"
DEFAULT_MSG
METIS_INCLUDE_DIR
METIS_LIBRARY
)
# check metis library
if
(
METIS_LIBRARY
)
set
(
METIS
_LIBRARIES
${
METIS_LIBRARY
}
)
list
(
APPEND
CMAKE_REQUIRED_LIBRARIES
${
METIS_LIBRAR
IES
}
)
list
(
APPEND CMAKE_REQUIRED
_LIBRARIES
${
METIS_LIBRAR
I
Y
}
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
CMAKE_REQUIRED_LIBRARIES
}
${
METIS_LIBRAR
Y
}
)
include
(
CheckSymbolExists
)
check_symbol_exists
(
METIS_PartMeshDual metis.h METIS_FOUND
)
endif
(
METIS_LIBRARY
)
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
)
message
(
STATUS
"METIS found. Include directories are
${
METIS_INCLUDE_DIRS
}
and libraries are
${
METIS_LIBRARIES
}
"
)
set
(
METIS_INCLUDE_DIRS
${
METIS_INCLUDE_DIR
}
)
set
(
METIS_LIBRARIES
${
METIS_LIBRARY
}
)
# 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
)
message
(
WARNING
"No functional 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
)
function
(
add_dune_metis_flags _targets
)
if
(
METIS_FOUND
)
foreach
(
_target
${
_targets
}
)
target_link_libraries
(
${
_target
}
${
METIS_LIBRARY
}
)
endforeach
(
_target
${
_targets
}
)
set_property
(
TARGET
${
_targets
}
APPEND PROPERTIES
COMPILE_DIRECTORIES
${
METIS_INCLUDE_DIRS
}
)
endif
(
METIS_FOUND
)
endfunction
(
add_dune_metis_flags _targets
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment