-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
65 lines (46 loc) · 2.28 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
cmake_minimum_required(VERSION 3.7)
# ---------------------------------------------------------------------------
# Environment
# ---------------------------------------------------------------------------
if (NOT UNIX)
message(STATUS FATAL_ERROR "Unsupported OS")
endif (NOT UNIX)
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_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -faligned-new -Wall")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -march=native -faligned-new -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -march=native -faligned-new -Wall")
# ---------------------------------------------------------------------------
# 3rdParty
# ---------------------------------------------------------------------------
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include("${CMAKE_SOURCE_DIR}/thirdparty/gtest.cmake")
# ---------------------------------------------------------------------------
# Includes
# ---------------------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/include/local.cmake")
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/thirdparty/
${GTEST_INCLUDE_DIR}
${GMOCK_INCLUDE_DIR}
)
# ---------------------------------------------------------------------------
# Sources
# ---------------------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/src/local.cmake")
include("${CMAKE_SOURCE_DIR}/test/local.cmake")
# ---------------------------------------------------------------------------
# Executable
# ---------------------------------------------------------------------------
add_executable(db src/database.cpp ${INCLUDE_HPP})
target_link_libraries(db database -lpthread -lm -ltbb -latomic -ldl -ljemalloc)
# ---------------------------------------------------------------------------
# Gtest
# ---------------------------------------------------------------------------
add_executable(unit_tests test/gtest.cpp ${TEST_CPP})
target_link_libraries(unit_tests database gtest -lm -ltbb -latomic -ldl -ljemalloc -lpthread)