forked from Cylix/cpp_redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
88 lines (68 loc) · 1.41 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
###
# config
###
cmake_minimum_required(VERSION 2.8.1)
cmake_policy(SET CMP0042 NEW)
###
# verbose make
###
# set(CMAKE_VERBOSE_MAKEFILE TRUE)
###
# project
###
set(PROJECT cpp_redis)
project(${PROJECT} CXX)
###
# compilation options
###
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -W -Wall -Wextra")
###
# variables
###
set(DEPS_FOLDER ${PROJECT_SOURCE_DIR}/deps)
set(GTEST_INCLUDES ${DEPS_FOLDER}/gtest/include)
set(GTEST_LIBS ${DEPS_FOLDER}/gtest/lib)
set(CPP_REDIS_INCLUDES ${PROJECT_SOURCE_DIR}/includes)
###
# includes
###
include_directories(${CPP_REDIS_INCLUDES})
###
# link
###
link_directories(${GTEST_LIBS})
###
# sources
###
set(DIRS "sources" "sources/network" "sources/builders" "sources/replies")
foreach(dir ${DIRS})
# get directory sources
file(GLOB s_${dir} "${dir}/*.cpp")
# set sources
set(SOURCES ${SOURCES} ${s_${dir}})
endforeach()
###
# executable
###
add_library(${PROJECT} SHARED ${SOURCES})
target_link_libraries(${PROJECT} boost_system)
set_target_properties(${PROJECT}
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/target")
###
# install
###
install (TARGETS ${PROJECT} DESTINATION lib)
install (DIRECTORY ${CPP_REDIS_INCLUDES}/ DESTINATION include)
###
# examples
###
IF (BUILD_EXAMPLES)
add_subdirectory(examples)
ENDIF(BUILD_EXAMPLES)
###
# tests
###
IF (BUILD_TESTS)
add_subdirectory(tests)
ENDIF(BUILD_TESTS)