CMakeLists.txt 1.71 KB
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1
cmake_minimum_required(VERSION 3.13)
2
project(amdis LANGUAGES CXX VERSION 0.2)
3
4
5
6
7
8
9
10
11
12
13

#find dune-common and set the module path
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
  ${dune-common_MODULE_PATH})

#include the dune macros
include(DuneMacros)

# start a dune project with information from dune.module
dune_project()
Praetorius, Simon's avatar
Praetorius, Simon committed
14
15
16
dune_add_library(amdis)
add_dune_all_flags(amdis)
target_link_dune_default_libraries(amdis)
17

18
add_subdirectory("amdis")
19
20
add_subdirectory("bin")
add_subdirectory("cmake/modules")
21
22
add_subdirectory("examples" EXCLUDE_FROM_ALL)
add_subdirectory("libs")
23
add_subdirectory("test")
24

Praetorius, Simon's avatar
Praetorius, Simon committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
dune_target_link_libraries(amdis fmt)

if (MTL_FOUND)
  dune_target_link_libraries(amdis MTL::MTL)
  target_compile_definitions(amdis PUBLIC ENABLE_MTL)
endif (MTL_FOUND)

if (HYPRE_FOUND)
  dune_target_link_libraries(amdis HYPRE::HYPRE)
  target_compile_definitions(amdis PUBLIC ENABLE_HYPRE)
endif(HYPRE_FOUND)

if (EIGEN3_FOUND)
  dune_target_link_libraries(amdis Eigen3::Eigen)
  target_compile_definitions(amdis PUBLIC ENABLE_EIGEN)
endif (EIGEN3_FOUND)

if (PETSc_FOUND)
  dune_target_link_libraries(amdis PETSc::PETSc)
  target_compile_definitions(amdis PUBLIC ENABLE_PETSC)
endif (PETSc_FOUND)

47
48
option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF)
if (ENABLE_ALL_WARNINGS)
49
50
  target_compile_options(amdis PUBLIC "-Wall" "-Wpedantic"
                                      "-Wextra" "-Wnon-virtual-dtor"
51
52
                                      "-Wold-style-cast" "-Wcast-align"
                                      "-Woverloaded-virtual" "-Wconversion")
53
54
endif (ENABLE_ALL_WARNINGS)

Praetorius, Simon's avatar
Praetorius, Simon committed
55

56
57
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)