Fixed pool growing policy
[elliptics.git] / CMakeLists.txt
blobf4835c6e6ec460f975b010ded43ade3e9f0edba8
1 cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
2 cmake_policy (VERSION 2.6.0)
4 set(CMAKE_SKIP_RPATH OFF)
5 set(CMAKE_SKIP_BUILD_RPATH  OFF)
6 set(CMAKE_SKIP_INSTALL_RPATH OFF)
7 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
9 project (elliptics)
10 set(ELLIPTICS_VERSION_ABI "2.18")
11 set(ELLIPTICS_VERSION_MINOR "3.0")
13 option(WITH_PYTHON "Build python bindings" ON)
14 option(WITH_COCAINE "Build with cocaine support" ON)
15 option(WITH_EXAMPLES "Build example applications" ON)
16 option(WITH_SMACK "Build ioserv with smack backend" ON)
18 set(ELLIPTICS_VERSION "${ELLIPTICS_VERSION_ABI}.${ELLIPTICS_VERSION_MINOR}")
20 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
21 include(CheckLargefile)
22 include(CheckAtomic)
23 include(CheckSendfile)
24 include(CheckIoprio)
25 include(TestBigEndian)
26 include(CheckProcStats)
27 include(CreateStdint)
29 create_stdint(${CMAKE_BINARY_DIR}/include/elliptics/typedefs.h)
30 include_directories(${CMAKE_BINARY_DIR}/include/)
32 # Set id_size
33 if (NOT ID_SIZE)
34     set(ID_SIZE 64)
35 endif()
36 add_definitions(-DCONFIG_ID_SIZE=${ID_SIZE})
38 # Test endianess
39 test_big_endian(HAVE_BIG_ENDIAN)
40 if(HAVE_BIG_ENDIAN)
41     add_definitions(-DBYTEORDER=4321)
42     add_definitions(-DWORDS_BIGENDIAN=1)
43 else()
44     add_definitions(-DBYTEORDER=1234)
45 endif()
47 if (UNIX OR MINGW)
48     add_definitions(-W -Wall -Wextra -fstack-protector-all -fno-strict-aliasing -g)
49 endif()
51 # Check for threads
52 if (UNIX AND BSD)
53     set(CMAKE_THREAD_LIBS -pthread)
54     set(CMAKE_USE_PTHREADS ON)
55     set(CMAKE_EXE_LINKER_FLAGS -pthread -Wl,--as-needed)
56 endif()
58 set(CMAKE_THREAD_PREFER_PTHREAD ON)
59 find_package(Threads REQUIRED)
61 if(WITH_COCAINE)
62     find_package(ZMQ REQUIRED)
63     include_directories(${ZMQ_INCLUDE_DIRS})
65     # Find some cocaine
66     find_package(Cocaine REQUIRED)
67     include_directories(${COCAINE_INCLUDE_DIRS})
68     add_definitions(${COCAINE_CFLAGS})
69 endif()
71 # Find eblob
72 find_package(Eblob REQUIRED)
73 include_directories(${EBLOB_INCLUDE_DIRS})
75 if(WITH_SMACK)
76     # Find smack
77     find_package(Smack REQUIRED)
78     include_directories(${SMACK_INCLUDE_DIRS})
79 endif()
81 # Collect all libraries together
82 set(ELLIPTICS_LIBRARIES
83     ${SENDFILE_LIBRARIES}
84     ${Boost_LIBRARIES}
85     ${EBLOB_LIBRARIES}
86     ${ZMQ_LIBRARIES}
87     ${COCAINE_LIBRARIES}
88     ${CMAKE_THREAD_LIBS_INIT}
89     )
91 # Build parts
92 add_subdirectory(srw)
93 add_subdirectory(cache)
94 add_subdirectory(library)
95 add_subdirectory(bindings)
96 if(WITH_EXAMPLES)
97     add_subdirectory(example)
98 endif()
100 install(FILES
101         include/elliptics/core.h
102         include/elliptics/cppdef.h
103         include/elliptics/interface.h
104         include/elliptics/packet.h
105         include/elliptics/srw.h
106         ${CMAKE_BINARY_DIR}/include/elliptics/typedefs.h
107         DESTINATION include/elliptics/
108         )