forked from tome2/tome2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
114 lines (94 loc) · 2.25 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Project definition.
PROJECT (tome2)
CMAKE_MINIMUM_REQUIRED (VERSION 3.5)
# We want a readable feature summary.
INCLUDE(FeatureSummary)
# pkg-config support
INCLUDE(FindPkgConfig)
#
# C++ standard
#
SET(CMAKE_CXX_STANDARD 17)
#
# Basic common compiler flags.
#
SET(COMMON_COMPILER_FLAGS "-pipe -Wall -Wextra -Wno-unused-value -Wno-unused-parameter")
#
# Sanitizer flags for debugging
#
SET(SANITIZER_FLAGS "-fsanitize=undefined -fsanitize=address")
#
# C Compiler Flags
#
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_COMPILER_FLAGS}")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ${SANITIZER_FLAGS}")
#
# C++ Compiler Flags
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILER_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJSONCONS_NO_DEPRECATED")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${SANITIZER_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
#
# GCC Flags
#
IF(CMAKE_COMPILER_IS_GNUCC)
# Nothing for now
ENDIF()
#
# Clang flags
#
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Nothing for now
ENDIF()
#
# fmt
#
ADD_DEFINITIONS(-DFMT_HEADER_ONLY)
# Add standard math library
SET(LIBS ${LIBS} m)
#
# BOOST
#
FIND_PACKAGE(Boost 1.54.0 COMPONENTS system filesystem)
SET_PACKAGE_PROPERTIES(Boost PROPERTIES TYPE REQUIRED)
IF(Boost_FOUND)
ADD_DEFINITIONS(-DBOOST_FILESYSTEM_NO_DEPRECATED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
SET(LIBS ${LIBS} ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
ENDIF()
#
# X11 support (OPTIONAL)
#
FIND_PACKAGE(X11)
#
# GTK2 support (OPTIONAL)
#
FIND_PACKAGE(GTK2)
#
# Curses support (OPTIONAL)
#
FIND_PACKAGE(Curses)
#
# Windows support
#
if(WIN32)
# This definition is required for more than just the main-win file,
# so we need to have it here.
ADD_DEFINITIONS(-DWINDOWS)
endif(WIN32)
#
# Set the path for loading the library bits.
#
IF(SYSTEM_INSTALL)
SET(DEFAULT_PATH "${CMAKE_INSTALL_PREFIX}/lib/tome")
ELSE()
SET(DEFAULT_PATH "./lib")
ENDIF()
ADD_DEFINITIONS(-DDEFAULT_PATH="${DEFAULT_PATH}")
# Print out a summary of features.
FEATURE_SUMMARY(FATAL_ON_MISSING_REQUIRED_PACKAGES WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND)
# Add the source subdirectory.
ADD_SUBDIRECTORY (src)
ADD_SUBDIRECTORY (lib)