AMDiSConfig.cmake.in 2.12 KB
Newer Older
1
2
3
@PACKAGE_INIT@

get_filename_component(AMDiS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
Praetorius, Simon's avatar
Praetorius, Simon committed
4
set(CMAKE_MODULE_PATH "${AMDiS_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
5
include(CMakeFindDependencyMacro)
6
7
8
9
10
11
12
13
14
15
include(FeatureSummary)

if (NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
    "Choose the type of build, options are: Debug Release [RelWithDebInfo] MinSizeRel."
    FORCE)
endif ()

# adopt pahts from AMDiS installation
include(find_dependencies)
16

Praetorius, Simon's avatar
Praetorius, Simon committed
17
# global dependencies
18
find_dependency(Boost ${Boost_VERSION_EXACT} REQUIRED COMPONENTS ${Boost_COMPONENTS})
19
find_dependency(MTL REQUIRED)
Praetorius, Simon's avatar
Praetorius, Simon committed
20
find_dependency(MuParser REQUIRED)
21
22
23
find_dependency(nanoflann)
find_dependency(PugiXML)

24
# if not component is specified, assume sequential
25
26
27
if (NOT AMDiS_FIND_REQUIRED_SEQUENTIAL AND NOT AMDiS_FIND_REQUIRED_PARALLEL)
  set (AMDiS_FIND_REQUIRED_SEQUENTIAL 1)
endif ()
28

29
# add sequential/parallel dependencies and add the amdis import target
Praetorius, Simon's avatar
Praetorius, Simon committed
30
if(AMDiS_FIND_REQUIRED_SEQUENTIAL AND NOT TARGET AMDiS::AMDiS-s)
31
32
33
  find_dependency(UMFPACK ${UMFPACK_VERSION_EXACT})
  find_dependency(HYPRE ${HYPRE_VERSION_EXACT})
  find_dependency(PETSc ${PETSc_VERSION_EXACT})
34
  find_dependency(MPI)
35
36
  include(AMDiSTargets-s OPTIONAL RESULT_VARIABLE AMDiS_SEQUENTIAL_FOUND)
  if (NOT AMDiS_SEQUENTIAL_FOUND)
37
    # fallback to parallel version if sequential does not exist
38
39
40
41
    set(AMDiS_FIND_REQUIRED_PARALLEL 1)
  endif (NOT AMDiS_SEQUENTIAL_FOUND)
endif()
if(AMDiS_FIND_REQUIRED_PARALLEL AND NOT TARGET AMDiS::AMDiS-p)
42
  find_dependency(MPI REQUIRED)
43
44
45
46
  find_dependency(PETSc ${PETSc_VERSION_EXACT} REQUIRED)
  find_dependency(Zoltan ${Zoltan_VERSION_EXACT})
  find_dependency(BDDCML ${BDDCML_VERSION_EXACT})
  include(AMDiSTargets-p OPTIONAL RESULT_VARIABLE AMDiS_PARALLEL_FOUND)
47
48
endif()

49
50
# add alias AMDiS that links to the sequential version by default
# only if component=PARALLEL it links to the parallel version
51
if (AMDiS_SEQUENTIAL_FOUND)
Praetorius, Simon's avatar
Praetorius, Simon committed
52
53
  add_library(AMDiS INTERFACE)
  target_link_libraries(AMDiS INTERFACE AMDiS::AMDiS-s)
54
elseif (AMDiS_PARALLEL_FOUND)
Praetorius, Simon's avatar
Praetorius, Simon committed
55
56
57
58
  add_library(AMDiS INTERFACE)
  target_link_libraries(AMDiS INTERFACE AMDiS::AMDiS-p)
endif ()

59
check_required_components(AMDiS)