-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
57 lines (47 loc) · 1.59 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
cmake_minimum_required (VERSION 3.2)
project (embdb)
set(APP_NAME embdb)
set(APP_LIB_NAME ${APP_NAME}_lib)
set(EMBDB_LAYOUT_DIR ${PROJECT_SOURCE_DIR}/embdb-layout)
set(CMAKE_CXX_STANDARD 17)
add_compile_options(-Wall -Werror -Wextra -fconcepts)
# App version
set(VERSION_MAJOR 0)
set(VERSION_MINOR 1)
set(VERSION_BUGFIX 0)
# Compilation date
EXECUTE_PROCESS(COMMAND "date" "-u" "+%F %R" OUTPUT_VARIABLE COMPILE_DATE)
string(REGEX REPLACE "\n$" "" COMPILE_DATE "${COMPILE_DATE}")
# Git version
EXECUTE_PROCESS(COMMAND
"git" "describe" "--always" "--tags" "--dirty" "--abbrev=5"
OUTPUT_VARIABLE GIT_HASH
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
string(REGEX REPLACE "\n$" "" GIT_HASH "${GIT_HASH}")
configure_file (
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
"${PROJECT_SOURCE_DIR}/src/version.hpp"
)
# Externals librarires
find_package(PkgConfig REQUIRED)
pkg_search_module(PROTO_BUF REQUIRED protobuf>=3.14.0)
pkg_search_module(LIBEVENT REQUIRED libevent>=2.0)
pkg_search_module(LIBEVENT_PTHREADS REQUIRED libevent_pthreads>=2.0)
find_package(nlohmann_json 3.2.0 REQUIRED)
# log4cplus supoprt
pkg_search_module(LOG4CPLUS log4cplus>=1.2.0)
if(LOG4CPLUS_FOUND)
message(STATUS "Using log4cplus version ${LOG4CPLUS_VERSION}")
set(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${LOG4CPLUS_LIBRARIES}")
else(LOG4CPLUS_FOUND)
message(STATUS "log4cplus support is disabled")
set(LOG4CPLUS_FOUND 0)
endif(LOG4CPLUS_FOUND)
# Compile the app
add_subdirectory(src)
# Compile the unit tests
option(COMPILE_GTESTS "Compile the tests" ON)
if(COMPILE_GTESTS)
add_subdirectory(gtests)
endif(COMPILE_GTESTS)