# ===== List aevol-flavor-independent post_treatments
set(AEVOL_POST_TREATMENTS
    extract_genomes
    make_ui_output_from_checkpoint
    make_ui_output_from_fasta
    )

# ========== Add prokaryote-specific post_treatments
set(AEVOL_PROKARYOTE_POST_TREATMENTS
    ancestor_stats
    lineage
    mutagenesis
    replicative_robustness
)

# ========== Add targets add their dependencies
macro(add_post_treatment RAW_FLAVOR POST_TREATMENT)
  set(FLAVORED_BIN_NAME aevol_post_${POST_TREATMENT}_${RAW_FLAVOR})
  add_executable(${FLAVORED_BIN_NAME} ${POST_TREATMENT}.cpp)
  target_link_libraries(${FLAVORED_BIN_NAME} PUBLIC libaevol_${RAW_FLAVOR})
  add_dependencies(aevol_${RAW_FLAVOR} ${FLAVORED_BIN_NAME})
  set(ALL_POST_TREATMENTS ${ALL_POST_TREATMENTS} ${FLAVORED_BIN_NAME})
endmacro()

# aevol-flavor-independent
foreach (AEVOL_RAW_FLAVOR IN LISTS AEVOL_RAW_FLAVORS)
  foreach (AEVOL_POST_TREATMENT IN LISTS AEVOL_POST_TREATMENTS)
    add_post_treatment(${AEVOL_RAW_FLAVOR} ${AEVOL_POST_TREATMENT})
  endforeach (AEVOL_POST_TREATMENT)
endforeach (AEVOL_RAW_FLAVOR)
# prokaryote-specific
foreach (AEVOL_PROKARYOTE_RAW_FLAVOR IN LISTS AEVOL_PROKARYOTE_RAW_FLAVORS)
  foreach (AEVOL_POST_TREATMENT IN LISTS AEVOL_PROKARYOTE_POST_TREATMENTS)
    add_post_treatment(${AEVOL_PROKARYOTE_RAW_FLAVOR} ${AEVOL_POST_TREATMENT})
  endforeach (AEVOL_POST_TREATMENT)
endforeach (AEVOL_PROKARYOTE_RAW_FLAVOR)

# ========== Set behaviour on make install
foreach (POST_TREATMENT IN LISTS ALL_POST_TREATMENTS)
  install(TARGETS ${POST_TREATMENT})
endforeach ()
