# The composition root of the hexagonal version, grown up: the core and
# the adapters are the hexagonal example's libraries, unchanged. Only the
# code that chooses, builds, and owns the objects is new.
add_library(arch_comp_root_app STATIC app.cpp config.cpp notifier_factory.cpp)
target_include_directories(arch_comp_root_app PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(arch_comp_root_app PUBLIC arch_hex_core arch_hex_memory arch_hex_stream arch_hex_console)

lld_add_example(arch_enrollment_composition_root SOURCES main.cpp EXPECTED_OUTPUT expected_output.txt)
target_link_libraries(arch_enrollment_composition_root PRIVATE arch_comp_root_app)

lld_add_test(arch_comp_root_config_tests SOURCES tests/test_config.cpp)
target_link_libraries(arch_comp_root_config_tests PRIVATE arch_comp_root_app)

lld_add_test(arch_comp_root_app_tests SOURCES tests/test_app.cpp)
target_link_libraries(arch_comp_root_app_tests PRIVATE arch_comp_root_app)

# main refuses an argument it does not know, before building anything.
add_test(NAME arch_comp_root_refuses_unknown_argument
  COMMAND arch_enrollment_composition_root --notify=email)
set_tests_properties(arch_comp_root_refuses_unknown_argument PROPERTIES
  WILL_FAIL TRUE LABELS "test")
