113b9a79aSTrond NorbyePROJECT(Memcached)
2f603fdb6STrond NorbyeCMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3f603fdb6STrond Norbye
48976c491STrond NorbyeIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
5a3eaba41STrond Norbye   EXECUTE_PROCESS(COMMAND git log -1 --pretty=format:%H
6c86d184fSTrond Norbye                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
7c86d184fSTrond Norbye                   OUTPUT_VARIABLE MEMCACHED_VERSION
8c86d184fSTrond Norbye                   ERROR_QUIET
9c86d184fSTrond Norbye                   OUTPUT_STRIP_TRAILING_WHITESPACE)
108976c491STrond NorbyeELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
11c86d184fSTrond Norbye   SET(MEMCACHED_VERSION "unknown")
128976c491STrond NorbyeENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
136ded21baSTrond Norbye
14bd1ef70eSTrond NorbyeCHECK_INCLUDE_FILE_CXX("atomic" HAVE_ATOMIC)
15bd1ef70eSTrond Norbye
16361a15b0STrond NorbyeCONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
17361a15b0STrond Norbye               ${CMAKE_CURRENT_BINARY_DIR}/config.h)
186ded21baSTrond Norbye
193b74a8a3STrond NorbyeIF (ENABLE_DTRACE)
203b74a8a3STrond Norbye   ADD_DEFINITIONS(-DENABLE_DTRACE=1)
213b74a8a3STrond NorbyeENDIF (ENABLE_DTRACE)
223b74a8a3STrond Norbye
233b74a8a3STrond NorbyeADD_CUSTOM_COMMAND(OUTPUT ${Memcached_BINARY_DIR}/memcached_dtrace.h
243b74a8a3STrond Norbye                   COMMAND
253b74a8a3STrond Norbye                     ${DTRACE} -h
263b74a8a3STrond Norbye                               -s ${Memcached_SOURCE_DIR}/memcached_dtrace.d
273b74a8a3STrond Norbye                               -o ${Memcached_BINARY_DIR}/memcached_dtrace.h
283b74a8a3STrond Norbye                   DEPENDS
293b74a8a3STrond Norbye                         memcached_dtrace.d
303b74a8a3STrond Norbye                   COMMENT "Generating DTrace probe header file"
313b74a8a3STrond Norbye                   VERBATIM)
323b74a8a3STrond Norbye
33361a15b0STrond NorbyeINCLUDE_DIRECTORIES(BEFORE
34361a15b0STrond Norbye                    ${LIBEVENT_INCLUDE_DIR}
35361a15b0STrond Norbye                    ${SNAPPY_INCLUDE_DIR}
36361a15b0STrond Norbye                    ${OPENSSL_INCLUDE_DIR}
37361a15b0STrond Norbye                    ${CMAKE_INSTALL_PREFIX}/include
38361a15b0STrond Norbye                    ${CMAKE_CURRENT_SOURCE_DIR}/include
39361a15b0STrond Norbye                    ${CMAKE_CURRENT_BINARY_DIR}
40361a15b0STrond Norbye                    ${CMAKE_CURRENT_SOURCE_DIR}
41361a15b0STrond Norbye                    ${Platform_SOURCE_DIR}/include)
426ded21baSTrond Norbye
43e228ad6bSTrond NorbyeIF (MEMORY_ALLOCATOR)
44e228ad6bSTrond Norbye   INCLUDE_DIRECTORIES(AFTER ${MALLOC_INCLUDE_DIR})
45e228ad6bSTrond NorbyeELSE (MEMORY_ALLOCATOR)
46e228ad6bSTrond Norbye   SET(MALLOC_LIBRARIES "")
47e228ad6bSTrond NorbyeENDIF (MEMORY_ALLOCATOR)
48361a15b0STrond Norbye
49f603fdb6STrond NorbyeIF (WIN32)
50361a15b0STrond Norbye   INCLUDE_DIRECTORIES(AFTER ${Platform_SOURCE_DIR}/include/win32)
51f603fdb6STrond NorbyeELSE (WIN32)
52f603fdb6STrond Norbye   ADD_EXECUTABLE(mcbasher programs/mcbasher.cc)
53f603fdb6STrond Norbye   TARGET_LINK_LIBRARIES(mcbasher platform ${COUCHBASE_NETWORK_LIBS})
54f603fdb6STrond Norbye   ADD_EXECUTABLE(timedrun programs/timedrun.c)
55f603fdb6STrond NorbyeENDIF (WIN32)
56f603fdb6STrond Norbye
5724a7df3dSTrond NorbyeADD_SUBDIRECTORY(support-files)
5824a7df3dSTrond Norbye
59f603fdb6STrond Norbye#
60f603fdb6STrond Norbye# Add all of the libraries
61f603fdb6STrond Norbye#
62f603fdb6STrond NorbyeADD_LIBRARY(mcd_util SHARED
63f603fdb6STrond Norbye            utilities/config_parser.c
64f603fdb6STrond Norbye            utilities/engine_loader.c
65f603fdb6STrond Norbye            utilities/extension_loggers.c
66f603fdb6STrond Norbye            utilities/util.c)
67f603fdb6STrond NorbyeADD_LIBRARY(default_engine SHARED
68f603fdb6STrond Norbye            engines/default_engine/assoc.c
69f603fdb6STrond Norbye            engines/default_engine/default_engine.c
70f603fdb6STrond Norbye            engines/default_engine/items.c
71f603fdb6STrond Norbye            engines/default_engine/slabs.c)
72f603fdb6STrond NorbyeADD_LIBRARY(bucket_engine SHARED
73f603fdb6STrond Norbye            engines/bucket_engine/bucket_engine.c
74f603fdb6STrond Norbye            engines/bucket_engine/topkeys.c
75f603fdb6STrond Norbye            engines/bucket_engine/genhash.c)
76f603fdb6STrond NorbyeADD_LIBRARY(basic_engine_testsuite SHARED testsuite/basic_engine_testsuite.c)
77f603fdb6STrond NorbyeADD_LIBRARY(blackhole_logger SHARED extensions/loggers/blackhole_logger.c)
78f603fdb6STrond NorbyeADD_LIBRARY(fragment_rw_ops SHARED extensions/protocol/fragment_rw.c)
79f603fdb6STrond NorbyeADD_LIBRARY(stdin_term_handler SHARED extensions/daemon/stdin_check.c)
80f603fdb6STrond NorbyeADD_LIBRARY(tap_mock_engine SHARED engines/tap_mock_engine/tap_mock_engine.cc)
81f603fdb6STrond NorbyeADD_LIBRARY(bucket_engine_mock_engine SHARED
82f603fdb6STrond Norbye            engines/bucket_engine/mock_engine.c
83f603fdb6STrond Norbye            engines/bucket_engine/genhash.c)
849353b24dSTrond NorbyeADD_LIBRARY(file_logger SHARED extensions/loggers/file_logger.c)
85e73832dcSjimADD_LIBRARY(testapp_extension SHARED extensions/protocol/testapp_extension.c)
86f603fdb6STrond Norbye
87f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(default_engine PROPERTIES PREFIX "")
88f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(bucket_engine PROPERTIES PREFIX "")
89f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(basic_engine_testsuite PROPERTIES PREFIX "")
90f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(blackhole_logger PROPERTIES PREFIX "")
91f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(fragment_rw_ops PROPERTIES PREFIX "")
92f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(stdin_term_handler PROPERTIES PREFIX "")
93f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(tap_mock_engine PROPERTIES PREFIX "")
94f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(bucket_engine_mock_engine PROPERTIES PREFIX "")
959353b24dSTrond NorbyeSET_TARGET_PROPERTIES(file_logger PROPERTIES PREFIX "")
96e73832dcSjimSET_TARGET_PROPERTIES(testapp_extension PROPERTIES PREFIX "")
97f603fdb6STrond Norbye
98f603fdb6STrond Norbye#
99f603fdb6STrond Norbye# All of the binaries we're building
100f603fdb6STrond Norbye#
101f603fdb6STrond NorbyeADD_EXECUTABLE(bucket_engine_testapp
102f603fdb6STrond Norbye               engines/bucket_engine/testapp.c
103f603fdb6STrond Norbye               engines/bucket_engine/genhash.c)
104879eba45STrond NorbyeADD_EXECUTABLE(engine_testapp programs/engine_testapp/engine_testapp.c
105879eba45STrond Norbye                              programs/engine_testapp/mock_server.c
106879eba45STrond Norbye                              programs/engine_testapp/mock_server.h)
107bf15a4a7STrond NorbyeADD_EXECUTABLE(cbsasladm programs/cbsasladm.c
108bf15a4a7STrond Norbye                         programs/utilities.c
109bf15a4a7STrond Norbye                         programs/utilities.h)
110bf15a4a7STrond NorbyeADD_EXECUTABLE(mcstat programs/mcstat.c
111bf15a4a7STrond Norbye                      programs/utilities.c
112bf15a4a7STrond Norbye                      programs/utilities.h)
113bd1ef70eSTrond NorbyeADD_EXECUTABLE(mctimings programs/mctimings.c
114bd1ef70eSTrond Norbye                         programs/utilities.c
115d4ae8968STrond Norbye                         programs/utilities.h
116d4ae8968STrond Norbye                         utilities/protocol2text.c)
117b449bca0SDave RigbyADD_EXECUTABLE(mcctl programs/mcctl.c
118b449bca0SDave Rigby                     programs/utilities.c
119b449bca0SDave Rigby                     programs/utilities.h
120b449bca0SDave Rigby                     utilities/util.c)
121bd1ef70eSTrond Norbye
122a0661107STrond NorbyeADD_EXECUTABLE(mchello programs/mchello.c
123a0661107STrond Norbye                       programs/utilities.c
124a0661107STrond Norbye                       programs/utilities.h)
125d27f7ec5STrond NorbyeADD_EXECUTABLE(memcached_sizes tests/sizes.c)
126f603fdb6STrond NorbyeADD_EXECUTABLE(memcached
127f603fdb6STrond Norbye               daemon/alloc_hooks.c
128f603fdb6STrond Norbye               daemon/cache.c
129c00c8665STrond Norbye               daemon/cmdline.c
130c00c8665STrond Norbye               daemon/cmdline.h
1315a1e75deSTrond Norbye               daemon/config_util.c
1325a1e75deSTrond Norbye               daemon/config_util.h
1335a1e75deSTrond Norbye               daemon/config_parse.c
134f603fdb6STrond Norbye               daemon/daemon.c
135f603fdb6STrond Norbye               daemon/hash.c
136f603fdb6STrond Norbye               daemon/memcached.c
137f603fdb6STrond Norbye               daemon/privileges.c
138f603fdb6STrond Norbye               daemon/stats.c
139bd1ef70eSTrond Norbye               daemon/thread.c
140e73832dcSjim               daemon/timings.cc
141e73832dcSjim               daemon/mc_time.c)
142f603fdb6STrond Norbye
1433b74a8a3STrond NorbyeIF (ENABLE_DTRACE)
1443b74a8a3STrond Norbye   ADD_CUSTOM_TARGET(generate_memcached_dtrace_h
1453b74a8a3STrond Norbye                     DEPENDS ${Memcached_BINARY_DIR}/memcached_dtrace.h)
1463b74a8a3STrond Norbye   ADD_DEPENDENCIES(memcached generate_memcached_dtrace_h)
1473b74a8a3STrond Norbye   ADD_DEPENDENCIES(default_engine generate_memcached_dtrace_h)
1483b74a8a3STrond Norbye
1493b74a8a3STrond Norbye   IF (DTRACE_NEED_INSTUMENT)
1503b74a8a3STrond Norbye      ADD_CUSTOM_COMMAND(TARGET memcached PRE_LINK
1513b74a8a3STrond Norbye                         COMMAND
1523b74a8a3STrond Norbye                         ${DTRACE} -o memcached_dtrace.o
1533b74a8a3STrond Norbye                                   -G
1543b74a8a3STrond Norbye                                   -s ${Memcached_SOURCE_DIR}/memcached_dtrace.d
1553b74a8a3STrond Norbye                                   *.o
1563b74a8a3STrond Norbye                         WORKING_DIRECTORY ${Memcached_BINARY_DIR}/CMakeFiles/memcached.dir/daemon)
1573b74a8a3STrond Norbye      SET_TARGET_PROPERTIES(memcached PROPERTIES LINK_FLAGS
1583b74a8a3STrond Norbye                            "${Memcached_BINARY_DIR}/CMakeFiles/memcached.dir/daemon/memcached_dtrace.o")
1595cc2f8d9STrond Norbye
1605cc2f8d9STrond Norbye      ADD_CUSTOM_COMMAND(TARGET default_engine PRE_LINK
1615cc2f8d9STrond Norbye                         COMMAND
1625cc2f8d9STrond Norbye                         ${DTRACE} -o de_dtrace.o
1635cc2f8d9STrond Norbye                                   -G
1645cc2f8d9STrond Norbye                                   -s ${Memcached_SOURCE_DIR}/memcached_dtrace.d
1655cc2f8d9STrond Norbye                                   *.o
1665cc2f8d9STrond Norbye                         WORKING_DIRECTORY ${Memcached_BINARY_DIR}/CMakeFiles/default_engine.dir/engines/default_engine)
1675cc2f8d9STrond Norbye      SET_TARGET_PROPERTIES(default_engine PROPERTIES LINK_FLAGS
1685cc2f8d9STrond Norbye                            "${Memcached_BINARY_DIR}/CMakeFiles/default_engine.dir/engines/default_engine/de_dtrace.o")
1695cc2f8d9STrond Norbye
1703b74a8a3STrond Norbye   ENDIF (DTRACE_NEED_INSTUMENT)
1713b74a8a3STrond NorbyeENDIF (ENABLE_DTRACE)
1723b74a8a3STrond Norbye
173ddf861d1STrond NorbyeADD_EXECUTABLE(memcached_config_test tests/config_test.c
174ddf861d1STrond Norbye               daemon/config_util.c daemon/config_util.h)
175ddf861d1STrond NorbyeTARGET_LINK_LIBRARIES(memcached_config_test cJSON)
176d27f7ec5STrond NorbyeADD_EXECUTABLE(ssltest tests/ssltest.c
1775e2eff65STrond Norbye                       programs/utilities.c
1785e2eff65STrond Norbye                       programs/utilities.h)
1795e2eff65STrond Norbye
180f4b802c8SjimADD_EXECUTABLE(memcached_testapp tests/testapp.c daemon/cache.c programs/utilities.c)
181f603fdb6STrond Norbye
182e21fb479STrond NorbyeSET(CBSASL_SOURCES include/cbsasl/cbsasl.h include/cbsasl/visibility.h
183e21fb479STrond Norbye                   cbsasl/client.c cbsasl/common.c cbsasl/cram-md5/cram-md5.c
184e21fb479STrond Norbye                   cbsasl/cram-md5/cram-md5.h cbsasl/cram-md5/hmac.c
185e21fb479STrond Norbye                   cbsasl/cram-md5/hmac.h cbsasl/cram-md5/md5.c
186e21fb479STrond Norbye                   cbsasl/cram-md5/md5.h cbsasl/hash.c cbsasl/hash.h
187e21fb479STrond Norbye                   cbsasl/plain/plain.c cbsasl/plain/plain.h cbsasl/pwfile.c
188361a15b0STrond Norbye                   cbsasl/pwfile.h cbsasl/server.c cbsasl/strcmp.c
189361a15b0STrond Norbye                   cbsasl/util.h)
190e21fb479STrond Norbye
191e21fb479STrond NorbyeADD_LIBRARY(cbsasl SHARED ${CBSASL_SOURCES})
192e21fb479STrond NorbyeSET_TARGET_PROPERTIES(cbsasl PROPERTIES SOVERSION 1.1.1)
193e21fb479STrond NorbyeSET_TARGET_PROPERTIES(cbsasl PROPERTIES COMPILE_FLAGS -DBUILDING_CBSASL=1)
194e21fb479STrond NorbyeSET_TARGET_PROPERTIES(cbsasl PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
195e21fb479STrond Norbye
196e21fb479STrond NorbyeADD_EXECUTABLE(cbsasl_hmac_test tests/cbsasl/hmac_test.c
197e21fb479STrond Norbye                                cbsasl/cram-md5/hmac.c
198e21fb479STrond Norbye                                cbsasl/cram-md5/hmac.h
199e21fb479STrond Norbye                                cbsasl/cram-md5/md5.c
200e21fb479STrond Norbye                                cbsasl/cram-md5/md5.h)
201e21fb479STrond Norbye
202e21fb479STrond NorbyeADD_EXECUTABLE(cbsasl_pwfile_test tests/cbsasl/pwfile_test.c
203e21fb479STrond Norbye                                  cbsasl/pwfile.c
204e21fb479STrond Norbye                                  cbsasl/pwfile.h
205e21fb479STrond Norbye                                  cbsasl/hash.c
206e21fb479STrond Norbye                                  cbsasl/hash.h)
207e21fb479STrond Norbye
208e21fb479STrond Norbye# We're using an "internal api" of the library in the test so we can't
209e21fb479STrond Norbye# use the library we just built
210e21fb479STrond NorbyeADD_EXECUTABLE(sasl_test tests/cbsasl/sasl_server_test.c ${CBSASL_SOURCES})
211e21fb479STrond NorbyeSET_TARGET_PROPERTIES(sasl_test PROPERTIES COMPILE_FLAGS -DBUILDING_CBSASL=1)
212e21fb479STrond Norbye
213e21fb479STrond NorbyeADD_EXECUTABLE(cbsasl_test tests/cbsasl/cbsasl_test.c
214e21fb479STrond Norbye                           include/cbsasl/cbsasl.h
215e21fb479STrond Norbye                           include/cbsasl/visibility.h)
216e21fb479STrond NorbyeTARGET_LINK_LIBRARIES(cbsasl_test cbsasl)
217e21fb479STrond Norbye
218e21fb479STrond NorbyeTARGET_LINK_LIBRARIES(cbsasl platform)
219e21fb479STrond NorbyeTARGET_LINK_LIBRARIES(cbsasl_pwfile_test platform)
220e21fb479STrond NorbyeTARGET_LINK_LIBRARIES(sasl_test platform)
221e21fb479STrond Norbye
222e21fb479STrond NorbyeADD_EXECUTABLE(cbsasl_strcmp_test tests/cbsasl/strcmp_test.c
223e21fb479STrond Norbye                                  include/cbsasl/cbsasl.h
224e21fb479STrond Norbye                                  include/cbsasl/visibility.h
225e21fb479STrond Norbye                                  cbsasl/strcmp.c)
226f603fdb6STrond Norbye#
227f603fdb6STrond Norbye# Add linker flags to all of the binaries
228f603fdb6STrond Norbye#
229e410e8bfSTrond NorbyeTARGET_LINK_LIBRARIES(bucket_engine mcd_util platform ${COUCHBASE_NETWORK_LIBS} ${COUCHBASE_MATH_LIBS})
230f603fdb6STrond NorbyeTARGET_LINK_LIBRARIES(default_engine mcd_util platform ${COUCHBASE_NETWORK_LIBS})
231f603fdb6STrond NorbyeTARGET_LINK_LIBRARIES(basic_engine_testsuite mcd_util platform ${COUCHBASE_NETWORK_LIBS})
232f603fdb6STrond NorbyeTARGET_LINK_LIBRARIES(stdin_term_handler platform)
233c1d099afSTrond NorbyeTARGET_LINK_LIBRARIES(fragment_rw_ops mcd_util platform ${COUCHBASE_NETWORK_LIBS})
234f603fdb6STrond NorbyeTARGET_LINK_LIBRARIES(engine_testapp mcd_util platform ${COUCHBASE_NETWORK_LIBS})
235e410e8bfSTrond NorbyeTARGET_LINK_LIBRARIES(bucket_engine_testapp mcd_util platform ${COUCHBASE_NETWORK_LIBS} ${COUCHBASE_MATH_LIBS})
236bf15a4a7STrond NorbyeTARGET_LINK_LIBRARIES(cbsasladm platform ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
237bf15a4a7STrond NorbyeTARGET_LINK_LIBRARIES(mcstat platform ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
238bd1ef70eSTrond NorbyeTARGET_LINK_LIBRARIES(mctimings cJSON platform ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
239b46157f8STrond NorbyeTARGET_LINK_LIBRARIES(mcctl platform ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
240a0661107STrond NorbyeTARGET_LINK_LIBRARIES(mchello platform ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
2415e2eff65STrond NorbyeTARGET_LINK_LIBRARIES(ssltest platform ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
242f603fdb6STrond NorbyeTARGET_LINK_LIBRARIES(tap_mock_engine platform ${COUCHBASE_NETWORK_LIBS})
243e73832dcSjimTARGET_LINK_LIBRARIES(testapp_extension mcd_util platform ${COUCHBASE_NETWORK_LIBS})
244f603fdb6STrond Norbye
245f603fdb6STrond NorbyeTARGET_LINK_LIBRARIES(mcd_util platform)
246e228ad6bSTrond NorbyeTARGET_LINK_LIBRARIES(memcached mcd_util cbsasl platform cJSON JSON_checker ${SNAPPY_LIBRARIES} ${MALLOC_LIBRARIES} ${LIBEVENT_LIBRARIES} ${OPENSSL_LIBRARIES} ${COUCHBASE_NETWORK_LIBS})
247f4b802c8SjimTARGET_LINK_LIBRARIES(memcached_testapp mcd_util cJSON platform ${SNAPPY_LIBRARIES} ${LIBEVENT_LIBRARIES} ${COUCHBASE_NETWORK_LIBS} ${OPENSSL_LIBRARIES})
248f603fdb6STrond Norbye
2496ae7c28bSTrond NorbyeTARGET_LINK_LIBRARIES(file_logger platform)
2509353b24dSTrond Norbye
251bac994b5STrond NorbyeIF (INSTALL_HEADER_FILES)
252361a15b0STrond Norbye   INSTALL (FILES include/memcached/allocator_hooks.h
253361a15b0STrond Norbye                  include/memcached/callback.h
254361a15b0STrond Norbye                  include/memcached/config_parser.h
255361a15b0STrond Norbye                  include/memcached/engine.h
256361a15b0STrond Norbye                  include/memcached/engine_common.h
257361a15b0STrond Norbye                  include/memcached/engine_testapp.h
258361a15b0STrond Norbye                  include/memcached/extension.h
259361a15b0STrond Norbye                  include/memcached/extension_loggers.h
260361a15b0STrond Norbye                  include/memcached/protocol_binary.h
261361a15b0STrond Norbye                  include/memcached/protocol_plugin.h
262361a15b0STrond Norbye                  include/memcached/server_api.h
263361a15b0STrond Norbye                  include/memcached/types.h
2648cfe8a90STrond Norbye                  include/memcached/dcp.h
265361a15b0STrond Norbye                  include/memcached/util.h
266361a15b0STrond Norbye                  include/memcached/vbucket.h
267361a15b0STrond Norbye                  include/memcached/visibility.h
268361a15b0STrond Norbye            DESTINATION include/memcached)
269361a15b0STrond Norbye
270361a15b0STrond Norbye   INSTALL(FILES
271361a15b0STrond Norbye           include/cbsasl/cbsasl.h
272361a15b0STrond Norbye           include/cbsasl/visibility.h
273361a15b0STrond Norbye           DESTINATION include/cbsasl)
274bac994b5STrond NorbyeENDIF(INSTALL_HEADER_FILES)
275f603fdb6STrond Norbye
276f603fdb6STrond NorbyeSET_TARGET_PROPERTIES(mcd_util PROPERTIES SOVERSION 1.0.0)
2770b758d35SCouchbase BuildmachineINSTALL(TARGETS mcd_util
278f603fdb6STrond Norbye        RUNTIME DESTINATION bin
279f603fdb6STrond Norbye        LIBRARY DESTINATION lib/memcached
280f603fdb6STrond Norbye        ARCHIVE DESTINATION lib/memcached)
281f603fdb6STrond Norbye
282361a15b0STrond NorbyeINSTALL(TARGETS default_engine bucket_engine blackhole_logger
283361a15b0STrond Norbye                fragment_rw_ops stdin_term_handler file_logger
2840b758d35SCouchbase Buildmachine        RUNTIME DESTINATION lib/memcached
2850b758d35SCouchbase Buildmachine        LIBRARY DESTINATION lib/memcached
2860b758d35SCouchbase Buildmachine        ARCHIVE DESTINATION lib/memcached)
2870b758d35SCouchbase Buildmachine
288c40ca9cbSTrond NorbyeSET_TARGET_PROPERTIES(mcd_util PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
289c40ca9cbSTrond NorbyeSET_TARGET_PROPERTIES(default_engine PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
290c40ca9cbSTrond NorbyeSET_TARGET_PROPERTIES(bucket_engine PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
291c40ca9cbSTrond NorbyeSET_TARGET_PROPERTIES(blackhole_logger PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
292c40ca9cbSTrond NorbyeSET_TARGET_PROPERTIES(fragment_rw_ops PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
293c40ca9cbSTrond NorbyeSET_TARGET_PROPERTIES(stdin_term_handler PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
2949353b24dSTrond NorbyeSET_TARGET_PROPERTIES(file_logger PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib/memcached)
295c40ca9cbSTrond Norbye
2969de7f95dSDave RigbyINSTALL(TARGETS engine_testapp cbsasladm mcctl mcstat mctimings memcached
297f603fdb6STrond Norbye        RUNTIME DESTINATION bin)
298f603fdb6STrond Norbye
299e21fb479STrond NorbyeINSTALL(TARGETS cbsasl
300e21fb479STrond Norbye        RUNTIME DESTINATION bin
301e21fb479STrond Norbye        LIBRARY DESTINATION lib
302e21fb479STrond Norbye        ARCHIVE DESTINATION lib)
303e21fb479STrond Norbye
304ddf861d1STrond NorbyeADD_TEST(memcached-config memcached_config_test)
305f603fdb6STrond NorbyeADD_TEST(memcached-sizes memcached_sizes)
306f603fdb6STrond NorbyeADD_TEST(memcached-basic-unit-tests memcached_testapp)
307a81e5c80STrond NorbyeADD_TEST(memcached-bucket_engine-unit-tests bucket_engine_testapp)
308a81e5c80STrond NorbyeADD_TEST(memcached-basic-engine-tests engine_testapp -E default_engine.so -T basic_engine_testsuite.so)
309f603fdb6STrond Norbye
3100a3e4d8eSTrond NorbyeIF(${COUCHBASE_PYTHON})
311410effdeSTrond Norbye    ADD_CUSTOM_COMMAND(OUTPUT
312410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_0.c
313410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_1.c
314410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_2.c
315410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_3.c
316410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_4.c
317410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_5.c
318410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_6.c
319410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_7.c
320410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_8.c
321410effdeSTrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_9.c
322410effdeSTrond Norbye                       COMMAND
323410effdeSTrond Norbye                           ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testsuite/breakdancer/engine_test.py
324410effdeSTrond Norbye                       DEPENDS
325410effdeSTrond Norbye                           testsuite/breakdancer/engine_test.py
326410effdeSTrond Norbye                           testsuite/breakdancer/breakdancer.py
327410effdeSTrond Norbye                       COMMENT "Generating testsuite")
328410effdeSTrond Norbye
329410effdeSTrond Norbye    ADD_LIBRARY(memcached_generated_testsuite SHARED
330410effdeSTrond Norbye                testsuite/breakdancer/suite_stubs.c
331410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_0.c
332410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_1.c
333410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_2.c
334410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_3.c
335410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_4.c
336410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_5.c
337410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_6.c
338410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_7.c
339410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_8.c
340410effdeSTrond Norbye                ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_9.c)
341410effdeSTrond Norbye
342410effdeSTrond Norbye    SET_TARGET_PROPERTIES(memcached_generated_testsuite PROPERTIES PREFIX "")
343410effdeSTrond Norbye    ADD_TEST(memcached-breakdancer-engine-tests engine_testapp -E default_engine.so -T memcached_generated_testsuite.so)
3440a3e4d8eSTrond NorbyeENDIF(${COUCHBASE_PYTHON})
345595bef70STrond Norbye
346b1fd94fbSDave RigbyIF ("${MEMORY_ALLOCATOR}" STREQUAL "tcmalloc")
3470e44a688STrond Norbye   ADD_EXECUTABLE(memcached_tcmalloc_test daemon/alloc_hooks.c
3480e44a688STrond Norbye                                          daemon/alloc_hooks.h
3490e44a688STrond Norbye                                          tests/tcmalloc_test.cc)
350e228ad6bSTrond Norbye   TARGET_LINK_LIBRARIES(memcached_tcmalloc_test platform ${TCMALLOC_LIBRARIES})
3510e44a688STrond Norbye   ADD_TEST(memcached-tcmalloc-hooks memcached_tcmalloc_test)
352b1fd94fbSDave RigbyENDIF ("${MEMORY_ALLOCATOR}" STREQUAL "tcmalloc")
3530e44a688STrond Norbye
354f4b802c8SjimCONFIGURE_FILE(tests/cert/testapp.pem tests/cert/testapp.pem COPYONLY)
355f4b802c8SjimCONFIGURE_FILE(tests/cert/testapp.cert tests/cert/testapp.cert COPYONLY)
3560e44a688STrond Norbye
357e21fb479STrond NorbyeADD_TEST(cbsasl-hmac cbsasl_hmac_test)
358e21fb479STrond NorbyeADD_TEST(cbsasl-pwfile cbsasl_pwfile_test)
359e21fb479STrond NorbyeADD_TEST(cbsasl-sasl sasl_test)
360e21fb479STrond NorbyeADD_TEST(cbsasl-client-server cbsasl_test)
361e21fb479STrond NorbyeADD_TEST(cbsasl-strcmp cbsasl_strcmp_test)
362e21fb479STrond Norbye
363595bef70STrond NorbyeADD_CUSTOM_TARGET(memcached-manpage
364595bef70STrond Norbye                  COMMAND a2x -L --doctype manpage --format manpage
365595bef70STrond Norbye                          ${CMAKE_CURRENT_SOURCE_DIR}/man/man4/memcached.json.4.txt
366595bef70STrond Norbye                  COMMAND a2x -L --doctype manpage --format pdf
367595bef70STrond Norbye                          ${CMAKE_CURRENT_SOURCE_DIR}/man/man4/memcached.json.4.txt
368595bef70STrond Norbye                  VERBATIM)
369595bef70STrond Norbye
370595bef70STrond NorbyeIF (NOT WIN32)
371595bef70STrond Norbye   INSTALL(FILES man/man4/memcached.json.4
372595bef70STrond Norbye           DESTINATION man/man4)
373595bef70STrond NorbyeENDIF(NOT WIN32)
374595bef70STrond Norbye
375595bef70STrond NorbyeINSTALL(FILES man/man4/memcached.json.4.pdf
376595bef70STrond Norbye        DESTINATION doc)
377b2c13f5aSTrond Norbye
378b2c13f5aSTrond NorbyeADD_EXECUTABLE(memcached_logger_test tests/logger_test.cc)
379b2c13f5aSTrond NorbyeTARGET_LINK_LIBRARIES(memcached_logger_test mcd_util file_logger dirutils)
380b2c13f5aSTrond NorbyeADD_TEST(memcached-logger-test memcached_logger_test)
381