forked from cda-tum/fiction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
78 lines (62 loc) · 2.5 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
# Large parts of this build system are based on Jason Turner's C++ Starter Project (https://github.com/lefticus/cpp_starter_project)
cmake_minimum_required(VERSION 3.15)
project(fiction
LANGUAGES CXX
VERSION 0.4.0)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/StandardProjectSettings.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/PreventInSourceBuilds.cmake)
# Set C++ standard; at least C++17 is required
set(FICTION_CXX_STANDARD "17" CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD ${FICTION_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Interface library to set project options
add_library(fiction_project_options INTERFACE)
# Option to enable time tracing with clang
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if (ENABLE_BUILD_WITH_TIME_TRACE)
target_compile_options(fiction_project_options INTERFACE -ftime-trace)
endif ()
endif ()
# Use the warnings specified in CompilerWarnings.cmake
add_library(fiction_project_warnings INTERFACE)
# Enable cache system
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Cache.cmake)
# Standard compiler warnings
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerWarnings.cmake)
set_project_warnings(fiction_project_warnings)
# Sanitizer options if supported by compiler
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Sanitizers.cmake)
enable_sanitizers(fiction_project_options)
# Allow for static analysis options
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/StaticAnalyzers.cmake)
# Enable progress bars
if (NOT WIN32)
option(FICTION_PROGRESS_BARS "Enable animated progress bars in command line" ON)
if (FICTION_PROGRESS_BARS)
target_compile_definitions(fiction_project_options INTERFACE PROGRESS_BARS)
endif ()
endif ()
# Include header files
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/include)
# CLI
option(FICTION_CLI "Build fiction CLI" ON)
if (FICTION_CLI)
message(STATUS "Building fiction CLI")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cli)
endif ()
# Experiments
option(FICTION_EXPERIMENTS "Build fiction experiments" OFF)
if (FICTION_EXPERIMENTS)
message(STATUS "Building fiction experiments")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/experiments)
endif ()
# Testing
option(FICTION_TEST "Build fiction tests" OFF)
if (FICTION_TEST)
enable_testing()
message(STATUS "Building fiction tests")
add_subdirectory(test)
endif ()
# Include libraries
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs)