add_library(gufo_cache STATIC completion.cpp identity.cpp ledger.cpp checkpoint.cpp prefix_index.cpp slot.cpp retention.cpp disk.cpp disk_catalog.cpp streaming.cpp)
target_include_directories(gufo_cache PUBLIC ${PROJECT_SOURCE_DIR})
# disk.cpp consumes the platform leaves.
target_link_libraries(gufo_cache PUBLIC Threads::Threads gufo_platform)
if (BUILD_TESTING)
  target_compile_options(gufo_cache PRIVATE -UNDEBUG)
  target_compile_definitions(gufo_cache PUBLIC GUFO_CACHE_TESTING)
endif()
if (GUFO_BUILD_TOOLS)
  add_executable(cache_ledger_bench ${PROJECT_SOURCE_DIR}/tests/cache/ledger_bench.cpp)
  target_link_libraries(cache_ledger_bench PRIVATE gufo_cache)
endif()

if (GUFO_BUILD_TOOLS)
  add_executable(cache_prefix_index_bench ${PROJECT_SOURCE_DIR}/tests/cache/prefix_index_bench.cpp)
  target_link_libraries(cache_prefix_index_bench PRIVATE gufo_cache)
  add_executable(cache_tiered_bench ${PROJECT_SOURCE_DIR}/tests/cache/tiered_bench.cpp)
  target_link_libraries(cache_tiered_bench PRIVATE gufo_cache)
endif()
