# CS-02 vending machine, 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  coins, change-making, coin sales, cancel, jams, the door
#   step-2  change: card payment through a stand-in

foreach(step IN ITEMS 1 2)
  add_library(cs_vending_step${step} STATIC step-${step}/coins.cpp step-${step}/machine.cpp)
  target_include_directories(cs_vending_step${step} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/step-${step})
  lld_add_test(cs_vending_step${step}_tests
    SOURCES step-${step}/tests/test_step${step}.cpp LABELS unit)
  target_link_libraries(cs_vending_step${step}_tests PRIVATE cs_vending_step${step})
  lld_add_example(cs_vending_step${step}_demo SOURCES step-${step}/main.cpp
    EXPECTED_OUTPUT step-${step}/expected_output.txt)
  target_link_libraries(cs_vending_step${step}_demo PRIVATE cs_vending_step${step})
endforeach()
