# CS-15 Connect Four, 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 7 by 6 board, moves checked before they change anything, a
#           win found from the last disc with four direction vectors, a draw
#   step-2  change: the board size and line length chosen when the game is
#           made, undo from a history of moves, and a computer opponent
set(cs_c4_sources_1 board.cpp game.cpp)
set(cs_c4_sources_2 ${cs_c4_sources_1} computer.cpp)
foreach(step IN ITEMS 1 2)
  list(TRANSFORM cs_c4_sources_${step} PREPEND step-${step}/ OUTPUT_VARIABLE sources)
  add_library(cs_c4_step${step} STATIC ${sources})
  target_include_directories(cs_c4_step${step} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/step-${step})
  lld_add_test(cs_c4_step${step}_tests
    SOURCES step-${step}/tests/test_step${step}.cpp LABELS unit)
  target_link_libraries(cs_c4_step${step}_tests PRIVATE cs_c4_step${step})
  lld_add_example(cs_c4_step${step}_demo SOURCES step-${step}/main.cpp
    EXPECTED_OUTPUT step-${step}/expected_output.txt)
  target_link_libraries(cs_c4_step${step}_demo PRIVATE cs_c4_step${step})
endforeach()
