# CS-05 cache eviction, built in steps. Each step is the whole program at
# that point in the study, and is built and tested on its own.
#   step-1  a bounded cache whose eviction policy (LRU, LFU, FIFO) is a
#           strategy chosen at construction
#   step-2  change: entries that expire, and a thread-safe wrapper
find_package(Threads REQUIRED)

foreach(step IN ITEMS 1 2)
  add_library(cs_cache_step${step} INTERFACE)
  target_include_directories(cs_cache_step${step} INTERFACE
    ${CMAKE_CURRENT_SOURCE_DIR}/step-${step})
  target_link_libraries(cs_cache_step${step} INTERFACE Threads::Threads)
  lld_add_test(cs_cache_step${step}_tests
    SOURCES step-${step}/tests/test_step${step}.cpp LABELS unit concurrency)
  target_link_libraries(cs_cache_step${step}_tests PRIVATE cs_cache_step${step})
  lld_add_example(cs_cache_step${step}_demo SOURCES step-${step}/main.cpp
    EXPECTED_OUTPUT step-${step}/expected_output.txt)
  target_link_libraries(cs_cache_step${step}_demo PRIVATE cs_cache_step${step})
endforeach()
