forked from toshic/libelliptics_proxy
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
74 lines (56 loc) · 2.06 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
cmake_minimum_required( VERSION 2.6 )
set( LIB elliptics-proxy)
project( ${LIB} )
FILE (READ "${CMAKE_CURRENT_SOURCE_DIR}/debian/changelog" DEBCHANGELOG)
string(REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+)" DEBFULLVERSION "${DEBCHANGELOG}")
STRING (REGEX MATCH "([0-9]+\\.[0-9]+)" MAJOR_VERSION "${DEBFULLVERSION}")
STRING (REGEX MATCH "([0-9]+$)" MINOR_VERSION "${DEBFULLVERSION}")
option(WITH_METABASE "Build with metabase and metabalancer support" ON)
SET(HAVE_METABASE false)
SET(CMAKE_CXX_FLAGS "-O0 -Wall -pedantic -std=c++0x")
find_package(Boost COMPONENTS system thread REQUIRED)
set(REQUIRED_LIBRARIES
elliptics_cpp
curl
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY})
IF(WITH_METABASE)
SET(HAVE_METABASE true)
FIND_LIBRARY(DEALER NAMES cocaine-dealer)
IF(${DEALER} STREQUAL "DEALER-NOTFOUND")
SET(HAVE_METABASE false)
ENDIF()
IF(HAVE_METABASE)
SET(REQUIRED_LIBRARIES
${REQUIRED_LIBRARIES}
${DEALER})
ENDIF()
message("Metabase: ${HAVE_METABASE} ${REQUIRED_LIBRARIES}")
ENDIF()
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/include/elliptics/proxy.hpp"
"${PROJECT_SOURCE_DIR}/include/elliptics/proxy.hpp")
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/include)
AUX_SOURCE_DIRECTORY(src SOURCES)
ADD_LIBRARY(${LIB} SHARED ${SOURCES})
SET_TARGET_PROPERTIES(${LIB} PROPERTIES
VERSION "${MAJOR_VERSION}.${MINOR_VERSION}"
SOVERSION ${MAJOR_VERSION})
TARGET_LINK_LIBRARIES(${LIB}
${REQUIRED_LIBRARIES})
INSTALL(TARGETS ${LIB}
RUNTIME DESTINATION bin COMPONENT runtime
LIBRARY DESTINATION lib COMPONENT runtime
ARCHIVE DESTINATION lib COMPONENT developement)
INSTALL(
DIRECTORY
include/
DESTINATION include
COMPONENT development)
set (TESTS_SOURCES
tests/test.cpp)
set (TEST test_${LIB})
add_executable (${TEST} ${TESTS_SOURCES})
target_link_libraries (${TEST} ${LIB})
enable_testing ()
add_test (${TEST} ${TEST})