-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
91 lines (75 loc) · 3.38 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
# ---------------------------------------------------------------------------
# IMLAB
# ---------------------------------------------------------------------------
project(imlab)
cmake_minimum_required(VERSION 3.7)
# ---------------------------------------------------------------------------
# Environment
# ---------------------------------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -fsanitize=address")
# Unfortunately, macOS (<= High Sierra) ships with a too old bison version.
# You need to manually install bison and flex via homebrew.
# (It's a good thing to have homebrew installed anyway)
# https://brew.sh/index_de.html
# - brew update
# - brew install bison flex
#
# As homebrew won't override the system's default bison, we need to tell
# cmake where it should look.
if (APPLE)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/bison)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/flex)
endif (APPLE)
# ---------------------------------------------------------------------------
# Dependencies
# ---------------------------------------------------------------------------
find_package(Threads REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(Protobuf REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include("${CMAKE_SOURCE_DIR}/vendor/benchmark.cmake")
include("${CMAKE_SOURCE_DIR}/vendor/googletest.cmake")
include("${CMAKE_SOURCE_DIR}/vendor/gflags.cmake")
include("${CMAKE_SOURCE_DIR}/vendor/cpplint.cmake")
include("${CMAKE_SOURCE_DIR}/vendor/rapidjson.cmake")
# ---------------------------------------------------------------------------
# Includes
# ---------------------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/include/local.cmake")
include_directories(
${CMAKE_SOURCE_DIR}/include
${GTEST_INCLUDE_DIR}
${GMOCK_INCLUDE_DIR}
${GFLAGS_INCLUDE_DIR}
${BENCHMARK_INCLUDE_DIR}
${RAPIDJSON_INCLUDE_DIR}
${PROTOBUF_INCLUDE_DIR}
)
# ---------------------------------------------------------------------------
# Sources
# ---------------------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/src/local.cmake")
include("${CMAKE_SOURCE_DIR}/test/local.cmake")
include("${CMAKE_SOURCE_DIR}/tools/local.cmake")
include("${CMAKE_SOURCE_DIR}/bench/local.cmake")
# ---------------------------------------------------------------------------
# Linting
# ---------------------------------------------------------------------------
add_custom_target(lint)
add_dependencies(lint ${lint_targets})
# ---------------------------------------------------------------------------
# Configuration
# ---------------------------------------------------------------------------
message(STATUS "[IMLAB] settings")
message(STATUS " GFLAGS_INCLUDE_DIR = ${GFLAGS_INCLUDE_DIR}")
message(STATUS " GFLAGS_LIBRARY_PATH = ${GFLAGS_LIBRARY_PATH}")
message(STATUS "[TEST] settings")
message(STATUS " GTEST_INCLUDE_DIR = ${GTEST_INCLUDE_DIR}")
message(STATUS " GTEST_LIBRARY_PATH = ${GTEST_LIBRARY_PATH}")
message(STATUS " GMOCK_INCLUDE_DIR = ${GMOCK_INCLUDE_DIR}")
message(STATUS " GMOCK_LIBRARY_PATH = ${GMOCK_LIBRARY_PATH}")