-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
80 lines (70 loc) · 2.74 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
cmake_minimum_required(VERSION 2.8.6)
project(kinetic_cpp_client_examples CXX C)
find_package (Threads)
set(CMAKE_CXX_FLAGS "-g --std=c++11 -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-null-dereference -DGTEST_USE_OWN_TR1_TUPLE=1 -D__STDC_FORMAT_MACROS")
set(GENERATED_SOURCES_PATH ${kinetic_cpp_client_SOURCE_DIR}/src/main/generated)
include(ExternalProject)
option(USE_LOCAL_KINETIC_CLIENT "Uses the kinetic client at the KINETIC_CLIENT_PATH variable instead of downloading library from Git" off)
if(USE_LOCAL_KINETIC_CLIENT)
else(USE_LOCAL_KINETIC_CLIENT)
set(KINETIC_CLIENT_PATH "${CMAKE_BINARY_DIR}/vendor/src/kinetic_cpp_client")
ExternalProject_add(
kinetic_cpp_client
PREFIX "vendor"
GIT_REPOSITORY "https://github.com/Seagate/kinetic-cpp-client.git"
GIT_TAG "0.1.1"
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
endif(USE_LOCAL_KINETIC_CLIENT)
include_directories(
${KINETIC_CLIENT_PATH}/vendor/include
${KINETIC_CLIENT_PATH}/src/main/generated
${KINETIC_CLIENT_PATH}/include
)
set(LIBRARY_DEPENDENCIES
${KINETIC_CLIENT_PATH}/libkinetic_client.a
${KINETIC_CLIENT_PATH}/vendor/lib/libglog.a
${KINETIC_CLIENT_PATH}/vendor/lib/libgflags.a
${KINETIC_CLIENT_PATH}/vendor/lib/libssl.a
${KINETIC_CLIENT_PATH}/vendor/lib/libcrypto.a
${KINETIC_CLIENT_PATH}/vendor/lib/libprotobuf.a
${CMAKE_THREAD_LIBS_INIT}
dl
)
# If libunwind is installed it is used by glog and thus has to linked.
# Otherwise glog uses the standard glibc unwinder and there is no dependency.
find_library(LIBUNWIND "unwind")
if(LIBUNWIND)
set(LIBRARY_DEPENDENCIES
${LIBRARY_DEPENDENCIES}
${LIBUNWIND}
)
endif()
macro(add_example_target NAME USE_EXAMPLE_MAIN)
if(${USE_EXAMPLE_MAIN})
add_executable(${NAME}
src/example_main.cc
src/${NAME}.cc)
else(${USE_EXAMPLE_MAIN})
add_executable(${NAME}
src/${NAME}.cc)
endif()
target_link_libraries(${NAME} ${LIBRARY_DEPENDENCIES})
add_dependencies(${NAME} kinetic_cpp_client)
endmacro(add_example_target)
add_example_target(kineticstat true)
add_example_target(ise true)
add_example_target(setclusterversion true)
add_example_target(setpin true)
add_example_target(set_acls true)
add_example_target(write_file_blocking true)
add_example_target(read_file_blocking true)
add_example_target(read_file_nonblocking false)
add_example_target(delete_file_nonblocking false)
add_example_target(delete_file_blocking false)
add_example_target(write_file_nonblocking true)
add_example_target(firmware_update false)
add_example_target(write_file_blocking_threads false)
add_example_target(dump_keyspace false)
add_example_target(copydrive false)