CMakeLists.txt 1.66 KB
Newer Older
1 2
cmake_minimum_required(VERSION 3.10)
project(dorie C CXX)
Dion Haefner's avatar
Dion Haefner committed
3

4 5 6
# Configuration options
option(COVERAGE_REPORT "Enable coverage compiler flags")

Dion Haefner's avatar
Dion Haefner committed
7 8
# set build type
if(NOT CMAKE_BUILD_TYPE)
9
  set(CMAKE_BUILD_TYPE "Release")
Dion Haefner's avatar
Dion Haefner committed
10 11 12 13
endif()

string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
14
  set(CMAKE_VERBOSE_MAKEFILE ON)
Dion Haefner's avatar
Dion Haefner committed
15 16
endif()

Lukas Riedel's avatar
Lukas Riedel committed
17 18
# add extra flags to debug compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
Dion Haefner's avatar
Dion Haefner committed
19 20

# 
Dion Haefner's avatar
Dion Haefner committed
21 22 23 24 25 26
if(NOT (dune-common_DIR OR dune-common_ROOT OR
      "${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
    string(REPLACE  ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
      ${PROJECT_BINARY_DIR})
endif()

Dion Haefner's avatar
Dion Haefner committed
27
# find dune-common and set the module path
Dion Haefner's avatar
Dion Haefner committed
28 29 30 31
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
  ${dune-common_MODULE_PATH})

Dion Haefner's avatar
Dion Haefner committed
32
# include the dune macros
Dion Haefner's avatar
Dion Haefner committed
33 34 35 36 37 38 39
include(DuneMacros)

# start a dune project with information from dune.module
dune_project()
dune_enable_all_packages()
dune_require_cxx_standard(MODULE "dorie" VERSION 14)

40 41 42 43
# Cache the executable path
set(DORIE_EXE_PATH ${PROJECT_BINARY_DIR}/dune/dorie/
    CACHE STRING "Path to the directory containing the executables")

Dion Haefner's avatar
Dion Haefner committed
44
# add subdirectories
45
add_subdirectory("plugins/vendor")
Dion Haefner's avatar
Dion Haefner committed
46
add_subdirectory("m4")
47
add_subdirectory("cmake/modules")
48
add_subdirectory("python")
49
add_subdirectory("doc")
Dion Haefner's avatar
Dion Haefner committed
50
add_subdirectory("dune")
51
add_subdirectory("lib")
52
if(DORIE_TESTING)
53
    add_subdirectory("test")
54
    add_subdirectory("doc/cookbook")
Dion Haefner's avatar
Dion Haefner committed
55 56 57 58
endif()
                  
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
59

Dion Haefner's avatar
Dion Haefner committed
60
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")