-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
82 lines (58 loc) · 2.98 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
cmake_minimum_required (VERSION 3.0)
#--------------------------------------------------------------------------------------------------#
project (libsdd)
#--------------------------------------------------------------------------------------------------#
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
#--------------------------------------------------------------------------------------------------#
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++1y" COMPILER_SUPPORTS_CXX14)
if (NOT COMPILER_SUPPORTS_CXX14)
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support.")
endif ()
#--------------------------------------------------------------------------------------------------#
find_package(Boost 1.59.0 REQUIRED COMPONENTS context coroutine system thread)
find_package(Doxygen QUIET)
find_package(Threads)
#--------------------------------------------------------------------------------------------------#
option(PACKED "Pack structures" OFF)
option(COVERAGE "Code coverage" OFF)
option(INTERNAL_DOC "Generate internal documentation" OFF)
#--------------------------------------------------------------------------------------------------#
if (PACKED)
add_definitions("-DLIBSDD_PACKED")
endif ()
#--------------------------------------------------------------------------------------------------#
if (COVERAGE)
include(CodeCoverage)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
setup_target_for_coverage(coverage tests coverage)
endif ()
#--------------------------------------------------------------------------------------------------#
if (DOXYGEN_FOUND)
if (INTERNAL_DOC)
set(GEN_INTERNAL_DOC "YES")
else ()
set(GEN_INTERNAL_DOC "NO")
endif ()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
)
endif ()
#--------------------------------------------------------------------------------------------------#
set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++1y ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 ${CMAKE_CXX_FLAGS_DEBUG}")
#--------------------------------------------------------------------------------------------------#
include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
include_directories("${PROJECT_SOURCE_DIR}")
#--------------------------------------------------------------------------------------------------#
add_subdirectory(sdd)
add_subdirectory(examples)
enable_testing()
add_subdirectory(tests)
#--------------------------------------------------------------------------------------------------#