1ca6022cdSTrond NorbyePROJECT(Couchstore)
2ca6022cdSTrond NorbyeCMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3ca6022cdSTrond Norbye
446f1ef48STrond NorbyeIF (${CMAKE_MAJOR_VERSION} GREATER 2)
546f1ef48STrond Norbye    CMAKE_POLICY(SET CMP0042 NEW)
646f1ef48STrond NorbyeENDIF (${CMAKE_MAJOR_VERSION} GREATER 2)
746f1ef48STrond Norbye
80c640a13STrond NorbyeINCLUDE(CheckFunctionExists)
90c640a13STrond NorbyeINCLUDE(CheckIncludeFile)
100c640a13STrond NorbyeINCLUDE(CheckIncludeFiles)
110c640a13STrond NorbyeINCLUDE(CheckLibraryExists)
120c640a13STrond NorbyeINCLUDE(CheckSymbolExists)
130c640a13STrond NorbyeINCLUDE(CheckTypeSize)
14346633adSDave RigbyINCLUDE(CTest)
15aca76c86SDave RigbyINCLUDE(GenerateExportHeader)
160c640a13STrond Norbye
17c80a2f8aSDave RigbyINCLUDE_DIRECTORIES(BEFORE ${CMAKE_INSTALL_PREFIX}/include
18c80a2f8aSDave Rigby                           ${CMAKE_CURRENT_SOURCE_DIR}/include
190c640a13STrond Norbye                           ${CMAKE_CURRENT_SOURCE_DIR}/src
200c640a13STrond Norbye                           ${CMAKE_CURRENT_BINARY_DIR}
21290dcd61STrond Norbye                           ${CMAKE_CURRENT_SOURCE_DIR}
227312d627SJung-Sang Ahn                           ${BOOST_INCLUDE_DIR}
23c80a2f8aSDave Rigby                           ${Platform_SOURCE_DIR}/include)
24c80a2f8aSDave Rigby
25fab83949STrond NorbyeINCLUDE_DIRECTORIES(AFTER ${gsl_lite_SOURCE_DIR}/include)
26fab83949STrond Norbye
27d897c709STrond NorbyeIF (LUA_FOUND)
28d897c709STrond Norbye   INCLUDE_DIRECTORIES(AFTER {LUA_INCLUDE_DIR})
29d897c709STrond NorbyeENDIF (LUA_FOUND)
30d897c709STrond Norbye
3119cd7c02STrond NorbyeINCLUDE_DIRECTORIES(AFTER
32ec877c45SDave Rigby                    ${KVEngineAPI_SOURCE_DIR}
33ec877c45SDave Rigby                    ${KVEngineAPI_BINARY_DIR})
349995e2f1STrond Norbye
350c640a13STrond NorbyeINCLUDE_DIRECTORIES(AFTER ${ICU_INCLUDE_DIR}
36fab83949STrond Norbye                          ${V8_INCLUDE_DIR})
370c640a13STrond Norbye
380c640a13STrond NorbyeCHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
390c640a13STrond NorbyeCHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H)
40462b7a82STrond NorbyeCHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
410c640a13STrond NorbyeCHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_FDATASYNC)
4223b42d51SSarath LakshmanCHECK_SYMBOL_EXISTS(qsort_r "stdlib.h" HAVE_QSORT_R)
430c640a13STrond Norbye
440c640a13STrond NorbyeIF (WIN32)
458f6123bfSWill Gardner  SET(COUCHSTORE_FILE_OPS "src/os_win.cc")
460c640a13STrond NorbyeELSE(WIN32)
478f6123bfSWill Gardner  SET(COUCHSTORE_FILE_OPS "src/os.cc")
480c640a13STrond NorbyeENDIF(WIN32)
490c640a13STrond Norbye
507312d627SJung-Sang AhnSET(COUCHSTORE_SOURCES src/arena.cc
517312d627SJung-Sang Ahn                       src/bitfield.cc
527312d627SJung-Sang Ahn                       src/btree_modify.cc
537312d627SJung-Sang Ahn                       src/btree_read.cc
547312d627SJung-Sang Ahn                       src/couch_db.cc
557312d627SJung-Sang Ahn                       src/couch_file_read.cc
567312d627SJung-Sang Ahn                       src/couch_file_write.cc
57ff146faeSJung-Sang Ahn                       src/couch_latency.cc
587312d627SJung-Sang Ahn                       src/couch_save.cc
597312d627SJung-Sang Ahn                       src/crc32.cc
607312d627SJung-Sang Ahn                       src/db_compact.cc
617312d627SJung-Sang Ahn                       src/file_merger.cc
627312d627SJung-Sang Ahn                       src/file_name_utils.c
637312d627SJung-Sang Ahn                       src/file_sorter.cc
647312d627SJung-Sang Ahn                       src/iobuffer.cc
657312d627SJung-Sang Ahn                       src/llmsort.cc
667312d627SJung-Sang Ahn                       src/mergesort.cc
677312d627SJung-Sang Ahn                       src/node_types.cc
687312d627SJung-Sang Ahn                       src/reduces.cc
697312d627SJung-Sang Ahn                       src/strerror.cc
707312d627SJung-Sang Ahn                       src/tree_writer.cc
717312d627SJung-Sang Ahn                       src/util.cc
727312d627SJung-Sang Ahn                       src/views/bitmap.c
737399e8cfSSriram Ganesan                       src/views/collate_json.cc
747312d627SJung-Sang Ahn                       src/views/file_merger.cc
757312d627SJung-Sang Ahn                       src/views/file_sorter.cc
767312d627SJung-Sang Ahn                       src/views/index_header.cc
777312d627SJung-Sang Ahn                       src/views/keys.cc
787312d627SJung-Sang Ahn                       src/views/mapreduce/mapreduce.cc
797312d627SJung-Sang Ahn                       src/views/mapreduce/mapreduce_c.cc
807312d627SJung-Sang Ahn                       src/views/reducers.cc
817312d627SJung-Sang Ahn                       src/views/reductions.cc
827312d627SJung-Sang Ahn                       src/views/sorted_list.c
837312d627SJung-Sang Ahn                       src/views/spatial.cc
847312d627SJung-Sang Ahn                       src/views/spatial_modify.cc
857312d627SJung-Sang Ahn                       src/views/util.cc
867312d627SJung-Sang Ahn                       src/views/values.cc
877312d627SJung-Sang Ahn                       src/views/view_group.cc
887312d627SJung-Sang Ahn                       src/views/purgers.cc
897312d627SJung-Sang Ahn                       src/views/compaction.cc
907312d627SJung-Sang Ahn                       src/quicksort.c
917312d627SJung-Sang Ahn                       ${COUCHSTORE_FILE_OPS})
92fab83949STrond NorbyeSET(COUCHSTORE_LIBRARIES ${V8_LIBRARIES} ${ICU_LIBRARIES} cbcompress platform)
930c640a13STrond Norbye
94bcc4d4baSWill GardnerSET(COUCHSTORE_GTEST_LIBRARIES gtest gtest_main gmock)
95bcc4d4baSWill GardnerSET(COUCHSTORE_GTEST_INCLUDES ${gtest_SOURCE_DIR}/include ${gmock_SOURCE_DIR}/include)
96bcc4d4baSWill Gardner
970c640a13STrond NorbyeADD_LIBRARY(couchstore SHARED ${COUCHSTORE_SOURCES})
9852f90763STrond NorbyeSET_TARGET_PROPERTIES(couchstore PROPERTIES COMPILE_FLAGS "-DLIBCOUCHSTORE_INTERNAL=1 -DLIBMAPREDUCE_INTERNAL=1")
990c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couchstore ${COUCHSTORE_LIBRARIES})
100aca76c86SDave RigbyGENERATE_EXPORT_HEADER(couchstore
101aca76c86SDave Rigby                       EXPORT_MACRO_NAME LIBCOUCHSTORE_API
102aca76c86SDave Rigby                       EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/libcouchstore/visibility.h
103aca76c86SDave Rigby                       NO_EXPORT_MACRO_NAME STATIC
104aca76c86SDave Rigby                       STATIC_DEFINE LIBCOUCHSTORE_NO_VISIBILITY)
105aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include)
1060c640a13STrond Norbye
107ec877c45SDave RigbyADD_EXECUTABLE(couch_dbdump
108ec877c45SDave Rigby               src/dbdump.cc
1095525660bSDave Rigby               src/tracking_file_ops.cc
110ec877c45SDave Rigby               ${COUCHSTORE_SOURCES}
111ec877c45SDave Rigby               ${KVEngineAPI_BINARY_DIR}/xattr/visibility.h)
112ec877c45SDave Rigby
113ec877c45SDave RigbyADD_DEPENDENCIES(couch_dbdump xattr)
11482fff8edSTrond NorbyeSET_TARGET_PROPERTIES(couch_dbdump PROPERTIES COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1")
115aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couch_dbdump
116aca76c86SDave Rigby        PRIVATE
117aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
11819cd7c02STrond NorbyeTARGET_LINK_LIBRARIES(couch_dbdump ${COUCHSTORE_LIBRARIES} xattr)
1190c640a13STrond Norbye
1201edc19a9SJung-Sang AhnADD_EXECUTABLE(couch_dbck src/dbck.cc)
1211edc19a9SJung-Sang AhnTARGET_LINK_LIBRARIES(couch_dbck couchstore platform)
1221edc19a9SJung-Sang Ahn
1230a34f4b2SJung-Sang AhnADD_EXECUTABLE(couch_dbinfo src/dbinfo.cc)
12433c63ffeSTrond NorbyeTARGET_LINK_LIBRARIES(couch_dbinfo couchstore platform)
1250c640a13STrond Norbye
1260a34f4b2SJung-Sang AhnADD_EXECUTABLE(couch_compact src/compactor.cc)
1270c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couch_compact couchstore)
1280c640a13STrond Norbye
129c4656abcSAman AchpalADD_EXECUTABLE(couch_view_file_merger src/views/bin/couch_view_file_merger.cc src/views/bin/util.cc)
1300c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couch_view_file_merger couchstore)
1310c640a13STrond Norbye
132c4656abcSAman AchpalADD_EXECUTABLE(couch_view_index_builder src/views/bin/couch_view_index_builder.cc src/views/bin/util.cc)
1330c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couch_view_index_builder couchstore)
1340c640a13STrond Norbye
135c4656abcSAman AchpalADD_EXECUTABLE(couch_view_group_cleanup src/views/bin/couch_view_group_cleanup.cc src/views/bin/util.cc)
136f2d99791SSarath LakshmanTARGET_LINK_LIBRARIES(couch_view_group_cleanup couchstore)
137f2d99791SSarath Lakshman
138c4656abcSAman AchpalADD_EXECUTABLE(couch_view_index_updater src/views/bin/couch_view_index_updater.cc src/views/bin/util.cc)
139ee29f96bSSarath LakshmanTARGET_LINK_LIBRARIES(couch_view_index_updater couchstore)
140ee29f96bSSarath Lakshman
141c4656abcSAman AchpalADD_EXECUTABLE(couch_view_group_compactor src/views/bin/couch_view_group_compactor.cc src/views/bin/util.cc)
142cc98f867SSarath LakshmanTARGET_LINK_LIBRARIES(couch_view_group_compactor couchstore)
143cc98f867SSarath Lakshman
14430b18fb0SJim WalkerADD_EXECUTABLE(couch_create src/couch_create.cc src/crc32.cc)
14530b18fb0SJim WalkerTARGET_LINK_LIBRARIES(couch_create couchstore platform)
14630b18fb0SJim Walker
14730b18fb0SJim Walker
148ae717639STrond NorbyeIF (INSTALL_HEADER_FILES)
1496212a318STrond Norbye   INSTALL(FILES
1506212a318STrond Norbye           include/libcouchstore/couch_db.h
1516212a318STrond Norbye           include/libcouchstore/couch_index.h
1526212a318STrond Norbye           include/libcouchstore/couch_common.h
1536212a318STrond Norbye           include/libcouchstore/error.h
1546212a318STrond Norbye           include/libcouchstore/file_ops.h
1556212a318STrond Norbye           include/libcouchstore/visibility.h
1566212a318STrond Norbye           DESTINATION include/libcouchstore)
157ae717639STrond NorbyeENDIF(INSTALL_HEADER_FILES)
1580c640a13STrond Norbye
1590c640a13STrond NorbyeINSTALL(TARGETS couchstore
1600c640a13STrond Norbye        RUNTIME DESTINATION bin
1610c640a13STrond Norbye        LIBRARY DESTINATION lib
1620c640a13STrond Norbye        ARCHIVE DESTINATION lib)
1630c640a13STrond Norbye
1647d6bc22aSMike WiederholdIF (APPLE)
1657d6bc22aSMike Wiederhold    SET_TARGET_PROPERTIES(couchstore
1667d6bc22aSMike Wiederhold                          PROPERTIES
1677d6bc22aSMike Wiederhold                          INSTALL_RPATH "@loader_path")
1687d6bc22aSMike WiederholdENDIF (APPLE)
1697d6bc22aSMike Wiederhold
1700c640a13STrond NorbyeINSTALL(TARGETS couch_dbdump
1710c640a13STrond Norbye                couch_dbinfo
1721edc19a9SJung-Sang Ahn                couch_dbck
1730c640a13STrond Norbye                couch_compact
1740c640a13STrond Norbye                couch_view_file_merger
1750c640a13STrond Norbye                couch_view_index_builder
176f2d99791SSarath Lakshman                couch_view_group_cleanup
177ee29f96bSSarath Lakshman                couch_view_index_updater
178cc98f867SSarath Lakshman                couch_view_group_compactor
1790c640a13STrond Norbye        RUNTIME DESTINATION bin)
1800c640a13STrond Norbye
181d40a6180STrond NorbyeINSTALL(FILES
182d40a6180STrond Norbye        python/couchstore.py
183d40a6180STrond Norbye        DESTINATION lib/python)
184d40a6180STrond Norbye
1850c640a13STrond NorbyeCONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in
1860c640a13STrond Norbye               ${CMAKE_CURRENT_BINARY_DIR}/config.h)
1870c640a13STrond Norbye
1880c640a13STrond Norbye# Tests:
1891b613a6bSAaron Miller
1900c640a13STrond NorbyeIF (LUA_FOUND)
1916212a318STrond Norbye   ADD_EXECUTABLE(couchscript src/couchscript.cc)
1926212a318STrond Norbye   SET_TARGET_PROPERTIES(couchscript PROPERTIES COMPILE_FLAGS
1936212a318STrond Norbye                         -I${LUA_INCLUDE_DIR})
1946212a318STrond Norbye   TARGET_LINK_LIBRARIES(couchscript couchstore ${LUA_LIBRARIES})
1956212a318STrond Norbye
1966212a318STrond Norbye   ADD_TEST(couchstore-localdoc
1976212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/localdoc.lua)
1986212a318STrond Norbye   ADD_TEST(couchstore-corrupt
1996212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/corrupt.lua)
2006212a318STrond Norbye   ADD_TEST(couchstore-bulk
2016212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/bulk.lua)
2026212a318STrond Norbye   ADD_TEST(couchstore-changes-since-filter
2036212a318STrond Norbye           couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/changessincefilter.lua)
2046212a318STrond Norbye   ADD_TEST(couchstore-compact
2056212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/compact.lua)
2066212a318STrond Norbye   ADD_TEST(couchstore-dropdel
2076212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/dropdel.lua)
2086212a318STrond Norbye   ADD_TEST(couchstore-largefile
2096212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/largefile.lua)
2106212a318STrond Norbye   ADD_TEST(couchstore-large
2116212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/large.lua)
2120c640a13STrond NorbyeENDIF(LUA_FOUND)
2130c640a13STrond Norbye
2141b613a6bSAaron MillerMACRO (M_ADD_PYTHON_TEST name pyfile)
2151b613a6bSAaron Miller  ADD_TEST(${name} python ${pyfile})
2161b613a6bSAaron Miller  SET_PROPERTY(TEST ${name} PROPERTY ENVIRONMENT
2171b613a6bSAaron Miller    "PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/python"
2181b613a6bSAaron Miller    "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}")
2191b613a6bSAaron MillerENDMACRO()
2201b613a6bSAaron Miller
221bc5b01eeSWill GardnerM_ADD_PYTHON_TEST(couchstore-purge ${CMAKE_CURRENT_SOURCE_DIR}/tests/purge.py)
222bc5b01eeSWill GardnerM_ADD_PYTHON_TEST(couchstore-rewind ${CMAKE_CURRENT_SOURCE_DIR}/tests/rewind.py)
223bc5b01eeSWill GardnerM_ADD_PYTHON_TEST(couchstore-changecount ${CMAKE_CURRENT_SOURCE_DIR}/tests/changecount.py)
2241b613a6bSAaron Miller
225bcc4d4baSWill GardnerMACRO (M_MAKE_LEGACY_TEST name)
226bcc4d4baSWill Gardner    ADD_EXECUTABLE(${name} ${ARGN})
227bcc4d4baSWill Gardner    SET_TARGET_PROPERTIES(${name} PROPERTIES
228bcc4d4baSWill Gardner            COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
229bcc4d4baSWill Gardner    TARGET_LINK_LIBRARIES(${name} couchstore)
230bcc4d4baSWill GardnerENDMACRO()
231bcc4d4baSWill Gardner
232bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_file-deduper-test
233bcc4d4baSWill Gardner        src/file_merger.cc
234bcc4d4baSWill Gardner        tests/file_deduper_tests.c)
235bcc4d4baSWill Gardner
236bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_file-merger-test
237bcc4d4baSWill Gardner        src/file_merger.cc
238bcc4d4baSWill Gardner        tests/file_merger_tests.c)
239bcc4d4baSWill Gardner
240bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_file-sorter-test
241bcc4d4baSWill Gardner        src/file_merger.cc
242bcc4d4baSWill Gardner        src/file_name_utils.c
243bcc4d4baSWill Gardner        src/file_sorter.cc
244bcc4d4baSWill Gardner        src/quicksort.c
245bcc4d4baSWill Gardner        tests/file_sorter_tests.c)
246bcc4d4baSWill Gardner
247bcc4d4baSWill GardnerSET(MAP_REDUCE_SOURCES
248bcc4d4baSWill Gardner        src/views/mapreduce/mapreduce.cc
2491f655e5eSharsha        src/views/mapreduce/mapreduce_c.cc)
250bcc4d4baSWill Gardner
251bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_mapreduce-builtin-test
252bcc4d4baSWill Gardner        ${MAP_REDUCE_SOURCES}
253bcc4d4baSWill Gardner        tests/mapreduce/builtin.c)
254bcc4d4baSWill Gardner
255bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_mapreduce-map-test
256bcc4d4baSWill Gardner        ${MAP_REDUCE_SOURCES}
257bcc4d4baSWill Gardner        tests/mapreduce/map.c)
258bcc4d4baSWill Gardner
259bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_mapreduce-reduce-test
260bcc4d4baSWill Gardner        ${MAP_REDUCE_SOURCES}
261bcc4d4baSWill Gardner        tests/mapreduce/reduce.c)
262bcc4d4baSWill Gardner
2635815fc1cSJim WalkerADD_EXECUTABLE(couchstore_testapp
2645815fc1cSJim Walker               tests/testapp.c
2650a34f4b2SJung-Sang Ahn               tests/views/tests.cc
2660a34f4b2SJung-Sang Ahn               tests/views/collate_json_test.cc
2670a34f4b2SJung-Sang Ahn               tests/views/index_headers.cc
2680a34f4b2SJung-Sang Ahn               tests/views/bitmaps.cc
2690a34f4b2SJung-Sang Ahn               tests/views/sorted_lists.cc
2700a34f4b2SJung-Sang Ahn               tests/views/reductions.cc
2710a34f4b2SJung-Sang Ahn               tests/views/keys.cc
2720a34f4b2SJung-Sang Ahn               tests/views/values.cc
2730a34f4b2SJung-Sang Ahn               tests/views/reducers.cc
2740a34f4b2SJung-Sang Ahn               tests/views/cleanup.cc
2750a34f4b2SJung-Sang Ahn               tests/views/spatial.cc
2765815fc1cSJim Walker               tests/btree_purge/purge_tests.h
2770a34f4b2SJung-Sang Ahn               tests/btree_purge/tests.cc
2780a34f4b2SJung-Sang Ahn               tests/btree_purge/purge.cc
2795815fc1cSJim Walker               ${COUCHSTORE_SOURCES})
2808fe9bd3bSVolker MischeSET_TARGET_PROPERTIES(couchstore_testapp PROPERTIES
281bcc4d4baSWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
282aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore_testapp
283aca76c86SDave Rigby        PRIVATE
284aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
285bcc4d4baSWill GardnerTARGET_LINK_LIBRARIES(couchstore_testapp ${COUCHSTORE_LIBRARIES})
2869b5a3b8dSJim Walker
2875815fc1cSJim WalkerADD_EXECUTABLE(couchstore_gtest
2885815fc1cSJim Walker               tests/couchstoretest.cc
2895815fc1cSJim Walker               tests/documents.cc
2905815fc1cSJim Walker               tests/gtest_tests.cc
291a864606fSWill Gardner               tests/test_fileops.cc
292a864606fSWill Gardner               src/node_types.cc
293a864606fSWill Gardner               ${COUCHSTORE_FILE_OPS})
2945815fc1cSJim WalkerSET_TARGET_PROPERTIES(couchstore_gtest PROPERTIES
2955815fc1cSJim Walker                      COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
296bcc4d4baSWill GardnerTARGET_INCLUDE_DIRECTORIES(couchstore_gtest PRIVATE ${COUCHSTORE_GTEST_INCLUDES})
297bcc4d4baSWill GardnerTARGET_LINK_LIBRARIES(couchstore_gtest couchstore ${COUCHSTORE_GTEST_LIBRARIES})
2985815fc1cSJim Walker
2991daef432SWill GardnerADD_EXECUTABLE(couchstore_internal_gtest
3001daef432SWill Gardner        tests/couchstoretest.cc
3011daef432SWill Gardner        tests/documents.cc
3021daef432SWill Gardner        tests/gtest_internal_tests.cc
303a864606fSWill Gardner        tests/test_fileops.cc
3041daef432SWill Gardner        ${COUCHSTORE_SOURCES}
3051daef432SWill Gardner        )
3061daef432SWill GardnerSET_TARGET_PROPERTIES(couchstore_internal_gtest PROPERTIES
3071daef432SWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
308aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore_internal_gtest
309aca76c86SDave Rigby        PRIVATE
310aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
3111daef432SWill GardnerTARGET_LINK_LIBRARIES(couchstore_internal_gtest
312bcc4d4baSWill Gardner        ${COUCHSTORE_GTEST_LIBRARIES}
3131daef432SWill Gardner        ${COUCHSTORE_LIBRARIES})
3141daef432SWill Gardner
315f7ebb47eSWill Gardner# This is an object library and can be used for verifying
316f7ebb47eSWill Gardner# FileOpsInterface implementations that wrap other FileOps
317f7ebb47eSWill Gardner# propogate errors correctly.
318f7ebb47eSWill Gardner#
319f7ebb47eSWill Gardner# Example usage can be found in tests/wrapped_fileops_test.cc
320f7ebb47eSWill GardnerADD_LIBRARY(couchstore_wrapped_fileops_test_framework OBJECT
321f7ebb47eSWill Gardner        tests/test_fileops.cc
322f7ebb47eSWill Gardner        ${COUCHSTORE_FILE_OPS})
323f7ebb47eSWill GardnerSET_TARGET_PROPERTIES(couchstore_wrapped_fileops_test_framework PROPERTIES
324f7ebb47eSWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
325f7ebb47eSWill GardnerTARGET_INCLUDE_DIRECTORIES(couchstore_wrapped_fileops_test_framework
326f7ebb47eSWill Gardner        PRIVATE
327aca76c86SDave Rigby        ${COUCHSTORE_GTEST_INCLUDES}
328aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
329f7ebb47eSWill Gardner
330f7ebb47eSWill GardnerADD_EXECUTABLE(couchstore_wrapped_fileops_test
3317312d627SJung-Sang Ahn               src/iobuffer.cc
3327312d627SJung-Sang Ahn               tests/wrapped_fileops_test.cc
3337312d627SJung-Sang Ahn               $<TARGET_OBJECTS:couchstore_wrapped_fileops_test_framework>
3347312d627SJung-Sang Ahn               )
335f7ebb47eSWill GardnerSET_TARGET_PROPERTIES(couchstore_wrapped_fileops_test PROPERTIES
336f7ebb47eSWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
337aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore_wrapped_fileops_test
338aca76c86SDave Rigby        PRIVATE
339aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
3400f3511deSharshaTARGET_LINK_LIBRARIES(couchstore_wrapped_fileops_test ${COUCHSTORE_GTEST_LIBRARIES} platform)
341f7ebb47eSWill Gardner
342b2319973SWill GardnerADD_LIBRARY(couchstore_test_fileops OBJECT
343b2319973SWill Gardner        tests/test_fileops.cc)
344b2319973SWill GardnerTARGET_INCLUDE_DIRECTORIES(couchstore_test_fileops
345b2319973SWill Gardner        PRIVATE
346aca76c86SDave Rigby        ${COUCHSTORE_GTEST_INCLUDES}
347aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
348b2319973SWill Gardner
349bcc4d4baSWill GardnerADD_TEST(couchstore-file-deduper-test couchstore_file-deduper-test)
350bcc4d4baSWill GardnerADD_TEST(couchstore-file-merge-test couchstore_file-merger-test)
351bcc4d4baSWill GardnerADD_TEST(couchstore-file-sorter-test couchstore_file-sorter-test)
352bcc4d4baSWill GardnerADD_TEST(couchstore-gtest couchstore_gtest)
353bcc4d4baSWill GardnerADD_TEST(couchstore-internal-gtest couchstore_internal_gtest)
354bcc4d4baSWill GardnerADD_TEST(couchstore-mapreduce-builtin-test couchstore_mapreduce-builtin-test)
355bcc4d4baSWill GardnerADD_TEST(couchstore-mapreduce-map-test couchstore_mapreduce-map-test)
356bcc4d4baSWill GardnerADD_TEST(couchstore-mapreduce-reduce-test couchstore_mapreduce-reduce-test)
357bcc4d4baSWill GardnerADD_TEST(couchstore-testapp couchstore_testapp)
358f7ebb47eSWill GardnerADD_TEST(couchstore-wrapped_fileops-test couchstore_wrapped_fileops_test)
359f7ebb47eSWill Gardner
360bcc4d4baSWill Gardner
361bcc4d4baSWill Gardner
36238a4c08aSTrond NorbyeADD_SUBDIRECTORY(programs)
3630b948c55SWill Gardner
3640b948c55SWill GardnerENABLE_CODE_COVERAGE_REPORT()
365