forked from erickschulz/NPDECODES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (65 loc) · 2.32 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.10)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.249.tar.gz"
SHA1 "d45d77d8bba9da13e9290a180e0477e90accd89b"
LOCAL # use cmake/Hunter/config.cmake
)
project(NPDECODES)
message("Project source dir =" "${PROJECT_SOURCE_DIR}")
message("Project binary dir =" "${PROJECT_BINARY_DIR}")
# Check that this is not an in-source build:
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif()
#setup compiler
set(CMAKE_CXX_STANDARD 17)
#enable warnings
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wall COMPILER_SUPPORTS_WALL)
CHECK_CXX_COMPILER_FLAG(-Wextra COMPILER_SUPPORTS_WEXTRA)
CHECK_CXX_COMPILER_FLAG(-Wconversion COMPILER_SUPPORTS_WCONVERSION)
add_library(warning_flags INTERFACE)
if(COMPILER_SUPPORTS_WALL)
target_compile_options(warning_flags INTERFACE -Wall)
endif()
if(COMPILER_SUPPORTS_WEXTRA)
target_compile_options(warning_flags INTERFACE -Wextra)
endif()
if(COMPILER_SUPPORTS_WCONVERSION)
target_compile_options(warning_flags INTERFACE -Wconversion)
endif()
# Get Dependencies
# (don't forget to update cmake/Config.cmake.in !
###############################################################################
# Get Eigen
hunter_add_package(Eigen)
find_package(Eigen3 CONFIG REQUIRED)
# Get LehrFEMpp
hunter_add_package(lehrfempp)
find_package(lehrfempp CONFIG REQUIRED)
# Get Google Test
hunter_add_package(GTest)
find_package(GTest CONFIG REQUIRED)
###############################################################################
# Add switches
option(HOMEWORKS "usage: cmake -DHOMEWORKS=ON/OFF .." ON)
message(STATUS "HOMEWORKS ${HOMEWORKS}")
option(DEVELOPERS "usage: cmake -DDEVELOPERS=ON/OFF .." ON)
message(STATUS "DEVELOPERS ${DEVELOPERS}")
option(LECTURECODES "usage: cmake -DLECTURECODES=ON/OFF .." ON)
message(STATUS "LECTURECODES ${LECTURECODES}")
option(MASTERSOLUTION "usage: cmake -DMASTERSOLUTION=ON/OFF .." ON)
message(STATUS "MASTERSOLUTION ${MASTERSOLUTION}")
option(MYSOLUTION "usage: cmake -DMYSOLUTION=ON/OFF .." ON)
message(STATUS "MYSOLUTION ${MYSOLUTION}")
# Add subdirectories
if(HOMEWORKS)
add_subdirectory(homeworks)
endif()
if(DEVELOPERS)
add_subdirectory(developers)
endif()
if(LECTURECODES)
add_subdirectory(lecturecodes)
endif()