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}
23c2c458ffSsduvuru                           ${Platform_SOURCE_DIR}/include
24c2c458ffSsduvuru                           ${phosphor_SOURCE_DIR}/include)
25c80a2f8aSDave Rigby
26fab83949STrond NorbyeINCLUDE_DIRECTORIES(AFTER ${gsl_lite_SOURCE_DIR}/include)
27fab83949STrond Norbye
28d897c709STrond NorbyeIF (LUA_FOUND)
29d897c709STrond Norbye   INCLUDE_DIRECTORIES(AFTER {LUA_INCLUDE_DIR})
30d897c709STrond NorbyeENDIF (LUA_FOUND)
31d897c709STrond Norbye
3219cd7c02STrond NorbyeINCLUDE_DIRECTORIES(AFTER
33ec877c45SDave Rigby                    ${KVEngineAPI_SOURCE_DIR}
34ec877c45SDave Rigby                    ${KVEngineAPI_BINARY_DIR})
359995e2f1STrond Norbye
360c640a13STrond NorbyeINCLUDE_DIRECTORIES(AFTER ${ICU_INCLUDE_DIR}
37fab83949STrond Norbye                          ${V8_INCLUDE_DIR})
380c640a13STrond Norbye
390c640a13STrond NorbyeCHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
400c640a13STrond NorbyeCHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H)
41462b7a82STrond NorbyeCHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
420c640a13STrond NorbyeCHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_FDATASYNC)
4323b42d51SSarath LakshmanCHECK_SYMBOL_EXISTS(qsort_r "stdlib.h" HAVE_QSORT_R)
440c640a13STrond Norbye
450c640a13STrond NorbyeIF (WIN32)
468f6123bfSWill Gardner  SET(COUCHSTORE_FILE_OPS "src/os_win.cc")
470c640a13STrond NorbyeELSE(WIN32)
488f6123bfSWill Gardner  SET(COUCHSTORE_FILE_OPS "src/os.cc")
490c640a13STrond NorbyeENDIF(WIN32)
500c640a13STrond Norbye
517312d627SJung-Sang AhnSET(COUCHSTORE_SOURCES src/arena.cc
527312d627SJung-Sang Ahn                       src/bitfield.cc
537312d627SJung-Sang Ahn                       src/btree_modify.cc
547312d627SJung-Sang Ahn                       src/btree_read.cc
557312d627SJung-Sang Ahn                       src/couch_db.cc
567312d627SJung-Sang Ahn                       src/couch_file_read.cc
577312d627SJung-Sang Ahn                       src/couch_file_write.cc
58ff146faeSJung-Sang Ahn                       src/couch_latency.cc
597312d627SJung-Sang Ahn                       src/couch_save.cc
607312d627SJung-Sang Ahn                       src/crc32.cc
617312d627SJung-Sang Ahn                       src/db_compact.cc
627312d627SJung-Sang Ahn                       src/file_merger.cc
637312d627SJung-Sang Ahn                       src/file_name_utils.c
647312d627SJung-Sang Ahn                       src/file_sorter.cc
657312d627SJung-Sang Ahn                       src/iobuffer.cc
667312d627SJung-Sang Ahn                       src/llmsort.cc
677312d627SJung-Sang Ahn                       src/mergesort.cc
687312d627SJung-Sang Ahn                       src/node_types.cc
697312d627SJung-Sang Ahn                       src/reduces.cc
707312d627SJung-Sang Ahn                       src/strerror.cc
717312d627SJung-Sang Ahn                       src/tree_writer.cc
727312d627SJung-Sang Ahn                       src/util.cc
737312d627SJung-Sang Ahn                       src/views/bitmap.c
747399e8cfSSriram Ganesan                       src/views/collate_json.cc
757312d627SJung-Sang Ahn                       src/views/file_merger.cc
767312d627SJung-Sang Ahn                       src/views/file_sorter.cc
777312d627SJung-Sang Ahn                       src/views/index_header.cc
787312d627SJung-Sang Ahn                       src/views/keys.cc
797312d627SJung-Sang Ahn                       src/views/mapreduce/mapreduce.cc
807312d627SJung-Sang Ahn                       src/views/mapreduce/mapreduce_c.cc
817312d627SJung-Sang Ahn                       src/views/reducers.cc
827312d627SJung-Sang Ahn                       src/views/reductions.cc
837312d627SJung-Sang Ahn                       src/views/sorted_list.c
847312d627SJung-Sang Ahn                       src/views/spatial.cc
857312d627SJung-Sang Ahn                       src/views/spatial_modify.cc
867312d627SJung-Sang Ahn                       src/views/util.cc
877312d627SJung-Sang Ahn                       src/views/values.cc
887312d627SJung-Sang Ahn                       src/views/view_group.cc
897312d627SJung-Sang Ahn                       src/views/purgers.cc
907312d627SJung-Sang Ahn                       src/views/compaction.cc
917312d627SJung-Sang Ahn                       src/quicksort.c
927312d627SJung-Sang Ahn                       ${COUCHSTORE_FILE_OPS})
93c2c458ffSsduvuruSET(COUCHSTORE_LIBRARIES ${V8_LIBRARIES} ${ICU_LIBRARIES} cbcompress platform phosphor)
940c640a13STrond Norbye
95c2c458ffSsduvuruSET(COUCHSTORE_GTEST_LIBRARIES gtest gtest_main gmock phosphor)
96bcc4d4baSWill GardnerSET(COUCHSTORE_GTEST_INCLUDES ${gtest_SOURCE_DIR}/include ${gmock_SOURCE_DIR}/include)
97bcc4d4baSWill Gardner
980c640a13STrond NorbyeADD_LIBRARY(couchstore SHARED ${COUCHSTORE_SOURCES})
9952f90763STrond NorbyeSET_TARGET_PROPERTIES(couchstore PROPERTIES COMPILE_FLAGS "-DLIBCOUCHSTORE_INTERNAL=1 -DLIBMAPREDUCE_INTERNAL=1")
1000c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couchstore ${COUCHSTORE_LIBRARIES})
101aca76c86SDave RigbyGENERATE_EXPORT_HEADER(couchstore
102aca76c86SDave Rigby                       EXPORT_MACRO_NAME LIBCOUCHSTORE_API
103aca76c86SDave Rigby                       EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/libcouchstore/visibility.h
104aca76c86SDave Rigby                       NO_EXPORT_MACRO_NAME STATIC
105aca76c86SDave Rigby                       STATIC_DEFINE LIBCOUCHSTORE_NO_VISIBILITY)
106aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include)
1070c640a13STrond Norbye
108ec877c45SDave RigbyADD_EXECUTABLE(couch_dbdump
109ec877c45SDave Rigby               src/dbdump.cc
1105525660bSDave Rigby               src/tracking_file_ops.cc
111ec877c45SDave Rigby               ${COUCHSTORE_SOURCES}
112ec877c45SDave Rigby               ${KVEngineAPI_BINARY_DIR}/xattr/visibility.h)
113ec877c45SDave Rigby
114ec877c45SDave RigbyADD_DEPENDENCIES(couch_dbdump xattr)
11582fff8edSTrond NorbyeSET_TARGET_PROPERTIES(couch_dbdump PROPERTIES COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1")
116aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couch_dbdump
117aca76c86SDave Rigby        PRIVATE
118aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
11919cd7c02STrond NorbyeTARGET_LINK_LIBRARIES(couch_dbdump ${COUCHSTORE_LIBRARIES} xattr)
1200c640a13STrond Norbye
1211edc19a9SJung-Sang AhnADD_EXECUTABLE(couch_dbck src/dbck.cc)
1221edc19a9SJung-Sang AhnTARGET_LINK_LIBRARIES(couch_dbck couchstore platform)
1231edc19a9SJung-Sang Ahn
1240a34f4b2SJung-Sang AhnADD_EXECUTABLE(couch_dbinfo src/dbinfo.cc)
12533c63ffeSTrond NorbyeTARGET_LINK_LIBRARIES(couch_dbinfo couchstore platform)
1260c640a13STrond Norbye
1270a34f4b2SJung-Sang AhnADD_EXECUTABLE(couch_compact src/compactor.cc)
1280c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couch_compact couchstore)
1290c640a13STrond Norbye
130c4656abcSAman AchpalADD_EXECUTABLE(couch_view_file_merger src/views/bin/couch_view_file_merger.cc src/views/bin/util.cc)
1310c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couch_view_file_merger couchstore)
1320c640a13STrond Norbye
133c4656abcSAman AchpalADD_EXECUTABLE(couch_view_index_builder src/views/bin/couch_view_index_builder.cc src/views/bin/util.cc)
1340c640a13STrond NorbyeTARGET_LINK_LIBRARIES(couch_view_index_builder couchstore)
1350c640a13STrond Norbye
136c4656abcSAman AchpalADD_EXECUTABLE(couch_view_group_cleanup src/views/bin/couch_view_group_cleanup.cc src/views/bin/util.cc)
137f2d99791SSarath LakshmanTARGET_LINK_LIBRARIES(couch_view_group_cleanup couchstore)
138f2d99791SSarath Lakshman
139c4656abcSAman AchpalADD_EXECUTABLE(couch_view_index_updater src/views/bin/couch_view_index_updater.cc src/views/bin/util.cc)
140ee29f96bSSarath LakshmanTARGET_LINK_LIBRARIES(couch_view_index_updater couchstore)
141ee29f96bSSarath Lakshman
142c4656abcSAman AchpalADD_EXECUTABLE(couch_view_group_compactor src/views/bin/couch_view_group_compactor.cc src/views/bin/util.cc)
143cc98f867SSarath LakshmanTARGET_LINK_LIBRARIES(couch_view_group_compactor couchstore)
144cc98f867SSarath Lakshman
14530b18fb0SJim WalkerADD_EXECUTABLE(couch_create src/couch_create.cc src/crc32.cc)
14630b18fb0SJim WalkerTARGET_LINK_LIBRARIES(couch_create couchstore platform)
14730b18fb0SJim Walker
14830b18fb0SJim Walker
149ae717639STrond NorbyeIF (INSTALL_HEADER_FILES)
1506212a318STrond Norbye   INSTALL(FILES
1516212a318STrond Norbye           include/libcouchstore/couch_db.h
1526212a318STrond Norbye           include/libcouchstore/couch_index.h
1536212a318STrond Norbye           include/libcouchstore/couch_common.h
1546212a318STrond Norbye           include/libcouchstore/error.h
1556212a318STrond Norbye           include/libcouchstore/file_ops.h
1566212a318STrond Norbye           include/libcouchstore/visibility.h
1576212a318STrond Norbye           DESTINATION include/libcouchstore)
158ae717639STrond NorbyeENDIF(INSTALL_HEADER_FILES)
1590c640a13STrond Norbye
1600c640a13STrond NorbyeINSTALL(TARGETS couchstore
1610c640a13STrond Norbye        RUNTIME DESTINATION bin
1620c640a13STrond Norbye        LIBRARY DESTINATION lib
1630c640a13STrond Norbye        ARCHIVE DESTINATION lib)
1640c640a13STrond Norbye
1657d6bc22aSMike WiederholdIF (APPLE)
1667d6bc22aSMike Wiederhold    SET_TARGET_PROPERTIES(couchstore
1677d6bc22aSMike Wiederhold                          PROPERTIES
1687d6bc22aSMike Wiederhold                          INSTALL_RPATH "@loader_path")
1697d6bc22aSMike WiederholdENDIF (APPLE)
1707d6bc22aSMike Wiederhold
1710c640a13STrond NorbyeINSTALL(TARGETS couch_dbdump
1720c640a13STrond Norbye                couch_dbinfo
1731edc19a9SJung-Sang Ahn                couch_dbck
1740c640a13STrond Norbye                couch_compact
1750c640a13STrond Norbye                couch_view_file_merger
1760c640a13STrond Norbye                couch_view_index_builder
177f2d99791SSarath Lakshman                couch_view_group_cleanup
178ee29f96bSSarath Lakshman                couch_view_index_updater
179cc98f867SSarath Lakshman                couch_view_group_compactor
1800c640a13STrond Norbye        RUNTIME DESTINATION bin)
1810c640a13STrond Norbye
182d40a6180STrond NorbyeINSTALL(FILES
183d40a6180STrond Norbye        python/couchstore.py
184d40a6180STrond Norbye        DESTINATION lib/python)
185d40a6180STrond Norbye
1860c640a13STrond NorbyeCONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in
1870c640a13STrond Norbye               ${CMAKE_CURRENT_BINARY_DIR}/config.h)
1880c640a13STrond Norbye
1890c640a13STrond Norbye# Tests:
1901b613a6bSAaron Miller
1910c640a13STrond NorbyeIF (LUA_FOUND)
1926212a318STrond Norbye   ADD_EXECUTABLE(couchscript src/couchscript.cc)
1936212a318STrond Norbye   SET_TARGET_PROPERTIES(couchscript PROPERTIES COMPILE_FLAGS
1946212a318STrond Norbye                         -I${LUA_INCLUDE_DIR})
1956212a318STrond Norbye   TARGET_LINK_LIBRARIES(couchscript couchstore ${LUA_LIBRARIES})
1966212a318STrond Norbye
1976212a318STrond Norbye   ADD_TEST(couchstore-localdoc
1986212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/localdoc.lua)
1996212a318STrond Norbye   ADD_TEST(couchstore-corrupt
2006212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/corrupt.lua)
2016212a318STrond Norbye   ADD_TEST(couchstore-bulk
2026212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/bulk.lua)
2036212a318STrond Norbye   ADD_TEST(couchstore-changes-since-filter
2046212a318STrond Norbye           couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/changessincefilter.lua)
2056212a318STrond Norbye   ADD_TEST(couchstore-compact
2066212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/compact.lua)
2076212a318STrond Norbye   ADD_TEST(couchstore-dropdel
2086212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/dropdel.lua)
2096212a318STrond Norbye   ADD_TEST(couchstore-largefile
2106212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/largefile.lua)
2116212a318STrond Norbye   ADD_TEST(couchstore-large
2126212a318STrond Norbye            couchscript ${CMAKE_CURRENT_SOURCE_DIR}/tests/large.lua)
2130c640a13STrond NorbyeENDIF(LUA_FOUND)
2140c640a13STrond Norbye
2151b613a6bSAaron MillerMACRO (M_ADD_PYTHON_TEST name pyfile)
2161b613a6bSAaron Miller  ADD_TEST(${name} python ${pyfile})
2171b613a6bSAaron Miller  SET_PROPERTY(TEST ${name} PROPERTY ENVIRONMENT
2181b613a6bSAaron Miller    "PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/python"
2191b613a6bSAaron Miller    "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}")
2201b613a6bSAaron MillerENDMACRO()
2211b613a6bSAaron Miller
222bc5b01eeSWill GardnerM_ADD_PYTHON_TEST(couchstore-purge ${CMAKE_CURRENT_SOURCE_DIR}/tests/purge.py)
223bc5b01eeSWill GardnerM_ADD_PYTHON_TEST(couchstore-rewind ${CMAKE_CURRENT_SOURCE_DIR}/tests/rewind.py)
224bc5b01eeSWill GardnerM_ADD_PYTHON_TEST(couchstore-changecount ${CMAKE_CURRENT_SOURCE_DIR}/tests/changecount.py)
2251b613a6bSAaron Miller
226bcc4d4baSWill GardnerMACRO (M_MAKE_LEGACY_TEST name)
227bcc4d4baSWill Gardner    ADD_EXECUTABLE(${name} ${ARGN})
228bcc4d4baSWill Gardner    SET_TARGET_PROPERTIES(${name} PROPERTIES
229bcc4d4baSWill Gardner            COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
230bcc4d4baSWill Gardner    TARGET_LINK_LIBRARIES(${name} couchstore)
231bcc4d4baSWill GardnerENDMACRO()
232bcc4d4baSWill Gardner
233bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_file-deduper-test
234bcc4d4baSWill Gardner        src/file_merger.cc
235bcc4d4baSWill Gardner        tests/file_deduper_tests.c)
236bcc4d4baSWill Gardner
237bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_file-merger-test
238bcc4d4baSWill Gardner        src/file_merger.cc
239bcc4d4baSWill Gardner        tests/file_merger_tests.c)
240bcc4d4baSWill Gardner
241bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_file-sorter-test
242bcc4d4baSWill Gardner        src/file_merger.cc
243bcc4d4baSWill Gardner        src/file_name_utils.c
244bcc4d4baSWill Gardner        src/file_sorter.cc
245bcc4d4baSWill Gardner        src/quicksort.c
246bcc4d4baSWill Gardner        tests/file_sorter_tests.c)
247bcc4d4baSWill Gardner
248bcc4d4baSWill GardnerSET(MAP_REDUCE_SOURCES
249bcc4d4baSWill Gardner        src/views/mapreduce/mapreduce.cc
2501f655e5eSharsha        src/views/mapreduce/mapreduce_c.cc)
251bcc4d4baSWill Gardner
252bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_mapreduce-builtin-test
253bcc4d4baSWill Gardner        ${MAP_REDUCE_SOURCES}
254bcc4d4baSWill Gardner        tests/mapreduce/builtin.c)
255bcc4d4baSWill Gardner
256bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_mapreduce-map-test
257bcc4d4baSWill Gardner        ${MAP_REDUCE_SOURCES}
258bcc4d4baSWill Gardner        tests/mapreduce/map.c)
259bcc4d4baSWill Gardner
260bcc4d4baSWill GardnerM_MAKE_LEGACY_TEST(couchstore_mapreduce-reduce-test
261bcc4d4baSWill Gardner        ${MAP_REDUCE_SOURCES}
262bcc4d4baSWill Gardner        tests/mapreduce/reduce.c)
263bcc4d4baSWill Gardner
2645815fc1cSJim WalkerADD_EXECUTABLE(couchstore_testapp
2655815fc1cSJim Walker               tests/testapp.c
2660a34f4b2SJung-Sang Ahn               tests/views/tests.cc
2670a34f4b2SJung-Sang Ahn               tests/views/collate_json_test.cc
2680a34f4b2SJung-Sang Ahn               tests/views/index_headers.cc
2690a34f4b2SJung-Sang Ahn               tests/views/bitmaps.cc
2700a34f4b2SJung-Sang Ahn               tests/views/sorted_lists.cc
2710a34f4b2SJung-Sang Ahn               tests/views/reductions.cc
2720a34f4b2SJung-Sang Ahn               tests/views/keys.cc
2730a34f4b2SJung-Sang Ahn               tests/views/values.cc
2740a34f4b2SJung-Sang Ahn               tests/views/reducers.cc
2750a34f4b2SJung-Sang Ahn               tests/views/cleanup.cc
2760a34f4b2SJung-Sang Ahn               tests/views/spatial.cc
2775815fc1cSJim Walker               tests/btree_purge/purge_tests.h
2780a34f4b2SJung-Sang Ahn               tests/btree_purge/tests.cc
2790a34f4b2SJung-Sang Ahn               tests/btree_purge/purge.cc
2805815fc1cSJim Walker               ${COUCHSTORE_SOURCES})
2818fe9bd3bSVolker MischeSET_TARGET_PROPERTIES(couchstore_testapp PROPERTIES
282bcc4d4baSWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
283aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore_testapp
284aca76c86SDave Rigby        PRIVATE
285aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
286bcc4d4baSWill GardnerTARGET_LINK_LIBRARIES(couchstore_testapp ${COUCHSTORE_LIBRARIES})
2879b5a3b8dSJim Walker
2885815fc1cSJim WalkerADD_EXECUTABLE(couchstore_gtest
2895815fc1cSJim Walker               tests/couchstoretest.cc
2905815fc1cSJim Walker               tests/documents.cc
2915815fc1cSJim Walker               tests/gtest_tests.cc
292a864606fSWill Gardner               tests/test_fileops.cc
293a864606fSWill Gardner               src/node_types.cc
294c2c458ffSsduvuru               src/crc32.cc
295a864606fSWill Gardner               ${COUCHSTORE_FILE_OPS})
2965815fc1cSJim WalkerSET_TARGET_PROPERTIES(couchstore_gtest PROPERTIES
2975815fc1cSJim Walker                      COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
298bcc4d4baSWill GardnerTARGET_INCLUDE_DIRECTORIES(couchstore_gtest PRIVATE ${COUCHSTORE_GTEST_INCLUDES})
299bcc4d4baSWill GardnerTARGET_LINK_LIBRARIES(couchstore_gtest couchstore ${COUCHSTORE_GTEST_LIBRARIES})
3005815fc1cSJim Walker
3011daef432SWill GardnerADD_EXECUTABLE(couchstore_internal_gtest
3021daef432SWill Gardner        tests/couchstoretest.cc
3031daef432SWill Gardner        tests/documents.cc
3041daef432SWill Gardner        tests/gtest_internal_tests.cc
305a864606fSWill Gardner        tests/test_fileops.cc
3061daef432SWill Gardner        ${COUCHSTORE_SOURCES}
3071daef432SWill Gardner        )
3081daef432SWill GardnerSET_TARGET_PROPERTIES(couchstore_internal_gtest PROPERTIES
3091daef432SWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
310aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore_internal_gtest
311aca76c86SDave Rigby        PRIVATE
312aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
3131daef432SWill GardnerTARGET_LINK_LIBRARIES(couchstore_internal_gtest
314bcc4d4baSWill Gardner        ${COUCHSTORE_GTEST_LIBRARIES}
3151daef432SWill Gardner        ${COUCHSTORE_LIBRARIES})
3161daef432SWill Gardner
317f7ebb47eSWill Gardner# This is an object library and can be used for verifying
318f7ebb47eSWill Gardner# FileOpsInterface implementations that wrap other FileOps
319f7ebb47eSWill Gardner# propogate errors correctly.
320f7ebb47eSWill Gardner#
321f7ebb47eSWill Gardner# Example usage can be found in tests/wrapped_fileops_test.cc
322f7ebb47eSWill GardnerADD_LIBRARY(couchstore_wrapped_fileops_test_framework OBJECT
323f7ebb47eSWill Gardner        tests/test_fileops.cc
324f7ebb47eSWill Gardner        ${COUCHSTORE_FILE_OPS})
325f7ebb47eSWill GardnerSET_TARGET_PROPERTIES(couchstore_wrapped_fileops_test_framework PROPERTIES
326f7ebb47eSWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
327f7ebb47eSWill GardnerTARGET_INCLUDE_DIRECTORIES(couchstore_wrapped_fileops_test_framework
328f7ebb47eSWill Gardner        PRIVATE
329aca76c86SDave Rigby        ${COUCHSTORE_GTEST_INCLUDES}
330aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
331f7ebb47eSWill Gardner
332f7ebb47eSWill GardnerADD_EXECUTABLE(couchstore_wrapped_fileops_test
333c2c458ffSsduvuru               src/crc32.cc
3347312d627SJung-Sang Ahn               src/iobuffer.cc
3357312d627SJung-Sang Ahn               tests/wrapped_fileops_test.cc
3367312d627SJung-Sang Ahn               $<TARGET_OBJECTS:couchstore_wrapped_fileops_test_framework>
3377312d627SJung-Sang Ahn               )
338f7ebb47eSWill GardnerSET_TARGET_PROPERTIES(couchstore_wrapped_fileops_test PROPERTIES
339f7ebb47eSWill Gardner        COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1 -DTESTAPP=1")
340aca76c86SDave RigbyTARGET_INCLUDE_DIRECTORIES(couchstore_wrapped_fileops_test
341aca76c86SDave Rigby        PRIVATE
342aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
3430f3511deSharshaTARGET_LINK_LIBRARIES(couchstore_wrapped_fileops_test ${COUCHSTORE_GTEST_LIBRARIES} platform)
344f7ebb47eSWill Gardner
345b2319973SWill GardnerADD_LIBRARY(couchstore_test_fileops OBJECT
346b2319973SWill Gardner        tests/test_fileops.cc)
347b2319973SWill GardnerTARGET_INCLUDE_DIRECTORIES(couchstore_test_fileops
348b2319973SWill Gardner        PRIVATE
349aca76c86SDave Rigby        ${COUCHSTORE_GTEST_INCLUDES}
350aca76c86SDave Rigby        ${CMAKE_CURRENT_BINARY_DIR}/include)
351b2319973SWill Gardner
352bcc4d4baSWill GardnerADD_TEST(couchstore-file-deduper-test couchstore_file-deduper-test)
353bcc4d4baSWill GardnerADD_TEST(couchstore-file-merge-test couchstore_file-merger-test)
354bcc4d4baSWill GardnerADD_TEST(couchstore-file-sorter-test couchstore_file-sorter-test)
355bcc4d4baSWill GardnerADD_TEST(couchstore-gtest couchstore_gtest)
356bcc4d4baSWill GardnerADD_TEST(couchstore-internal-gtest couchstore_internal_gtest)
357bcc4d4baSWill GardnerADD_TEST(couchstore-mapreduce-builtin-test couchstore_mapreduce-builtin-test)
358bcc4d4baSWill GardnerADD_TEST(couchstore-mapreduce-map-test couchstore_mapreduce-map-test)
359bcc4d4baSWill GardnerADD_TEST(couchstore-mapreduce-reduce-test couchstore_mapreduce-reduce-test)
360bcc4d4baSWill GardnerADD_TEST(couchstore-testapp couchstore_testapp)
361f7ebb47eSWill GardnerADD_TEST(couchstore-wrapped_fileops-test couchstore_wrapped_fileops_test)
362f7ebb47eSWill Gardner
363bcc4d4baSWill Gardner
364bcc4d4baSWill Gardner
36538a4c08aSTrond NorbyeADD_SUBDIRECTORY(programs)
3660b948c55SWill Gardner
3670b948c55SWill GardnerENABLE_CODE_COVERAGE_REPORT()
368