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

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

string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
	set(CMAKE_VERBOSE_MAKEFILE ON)
endif()

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

# 
Dion Haefner's avatar
Dion Haefner committed
18 19 20 21 22 23
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
24
# find dune-common and set the module path
Dion Haefner's avatar
Dion Haefner committed
25 26 27 28
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
29
# include the dune macros
Dion Haefner's avatar
Dion Haefner committed
30 31 32 33 34 35 36
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)

37 38 39 40
# 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
41
# add subdirectories
42
add_subdirectory("plugins/vendor")
Dion Haefner's avatar
Dion Haefner committed
43
add_subdirectory("m4")
44
add_subdirectory("cmake/modules")
45
add_subdirectory("python")
46
add_subdirectory("doc")
Dion Haefner's avatar
Dion Haefner committed
47
add_subdirectory("dune")
48
add_subdirectory("lib")
49
if(DORIE_TESTING)
50
    add_subdirectory("test")
51
    add_subdirectory("doc/cookbook")
Dion Haefner's avatar
Dion Haefner committed
52 53 54 55
endif()
                  
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
56

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