
add_compile_options(-Wall -Wextra -Wunreachable-code -Wuninitialized)

# Generating icons
execute_process(
    COMMAND python3 ${CMAKE_SOURCE_DIR}/scripts/gresource_to_c.py
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

set(CT_SHARED_FILES
    ct_actions_edit.cc
    ct_actions_export.cc
    ct_actions_file.cc
    ct_actions_find.cc
    ct_actions_format.cc
    ct_actions_others.cc
    ct_actions_tree.cc
    ct_actions_view.cc
    ct_app.cc
    ct_clipboard.cc
    ct_codebox.cc
    ct_config.cc
    ct_dialogs.cc
    ct_export2html.cc
    ct_export2pdf.cc
    ct_export2txt.cc
    ct_image.cc
    ct_imports.cc
    ct_list.cc
    ct_main_win.cc
    ct_menu.cc
    ct_misc_utils.cc
    ct_p7za_iface.cc
    ct_pref_dlg.cc
    ct_state_machine.cc
    ct_storage_control.cc
    ct_storage_sqlite.cc
    ct_storage_xml.cc
    ct_table.cc
    ct_treestore.cc
    ct_widgets.cc
)

add_library(cherrytree_shared STATIC ${CT_SHARED_FILES})
target_link_libraries(cherrytree_shared
    ${GTKMM_LIBRARIES}
    ${GTKSVMM_LIBRARIES}
    ${GLIBMM_LIBRARIES}
    ${PANGOMM_LIBRARIES}
    ${GSPELL_LIBRARIES}
    ${LIBXML_LIBRARIES}
    ${SQLITE_LIBRARIES}
    pthread
    7za_static
)

add_executable(cherrytree ct_main.cc icons.gresource.cc)
target_link_libraries(cherrytree cherrytree_shared)

set_target_properties(cherrytree PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")