-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (64 loc) · 2.55 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
cmake_minimum_required(VERSION 3.15)
project(bambooslacking)
set(CMAKE_CXX_STANDARD 17)
option(test "Build all tests" OFF)
set(cpprestsdk_DIR /usr/local/lib/cmake)
find_path(
LevelDB_INCLUDE NAMES leveldb/db.h
PATHS $ENV{LEVELDB_ROOT}/include /opt/local/include /usr/local/include /usr/include
DOC "Path in which the file leveldb/db.h is located."
)
find_library(LevelDB_LIBRARY NAMES leveldb
PATHS /usr/lib $ENV{LEVELDB_ROOT}/lib
DOC "Path to leveldb library."
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LevelDB DEFAULT_MSG LevelDB_INCLUDE LevelDB_LIBRARY)
if(LEVELDB_FOUND)
message(STATUS "Found LevelDB (include: ${LevelDB_INCLUDE}, library: ${LevelDB_LIBRARY})")
endif()
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
find_package(cpprestsdk REQUIRED)
find_package(Boost REQUIRED COMPONENTS atomic chrono thread exception)
set(TARGET_SOURCES
base64.cc easylogging++.cc slackapi.cc bamboohrapi.cc encryption.cc db.cc
app.cc common.cc network_utils.cc basic_controller.cc app_controller.cc uri.cc
)
list(TRANSFORM TARGET_SOURCES PREPEND "./src/")
add_executable(bambooslacking ./src/main.cc ${TARGET_SOURCES})
set(BAMBOOSLACKING_INCLUDE_DIR "./src/include")
target_include_directories(bambooslacking PRIVATE ${BAMBOOSLACKING_INCLUDE_DIR})
target_link_libraries(
bambooslacking PRIVATE
cpprestsdk::cpprest OpenSSL::SSL leveldb
Boost::atomic Boost::chrono Boost::exception Boost::thread Boost::date_time
)
### unit testing
if (test)
find_path(
gtest_INCLUDE NAMES gtest/gtest.h
PATHS /usr/include
DOC "Path in which the file /usr/include/gtest/gtest.h is located."
)
find_library(gtest_LIBRARY NAMES gtest
PATHS /usr/lib
DOC "Path to gtest library."
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(gtest DEFAULT_MSG gtest_INCLUDE gtest_LIBRARY)
if(gtest_FOUND)
message(STATUS "Found gtest (include: ${gtest_INCLUDE}, library: ${gtest_LIBRARY})")
endif()
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
enable_testing()
add_executable(bambooslacking-test ./test/main.cc)
target_include_directories(bambooslacking-test PRIVATE ${BAMBOOSLACKING_INCLUDE_DIR})
target_link_libraries(
bambooslacking-test PRIVATE
cpprestsdk::cpprest OpenSSL::SSL leveldb
Boost::atomic Boost::chrono Boost::exception Boost::thread Boost::date_time
gtest gtest_main
)
add_test(NAME bambooslackingTest COMMAND bambooslacking-test -v)
endif()