set(H_FILES
    mimetypedata.h
    mimetypeviewer.h
    applicationchooser.h
)

set(MOC_FILES
    mimetypedata.h
    mimetypeviewer.h
    applicationchooser.h
)

set(CPP_FILES
    mimetypedata.cpp
    mimetypeviewer.cpp
    applicationchooser.cpp
    main.cpp
)

set(UI_FILES
    mimetypeviewer.ui
    applicationchooser.ui
)

# Translations **********************************
lxqt_translate_ts(QM_FILES
    UPDATE_TRANSLATIONS
        ${UPDATE_TRANSLATIONS}
    SOURCES
        ${H_FILES}
        ${CPP_FILES}
        ${UI_FILES}
    TEMPLATE
        lxqt-config-file-associations
    INSTALL_DIR
        "${LXQT_TRANSLATIONS_DIR}/lxqt-config-file-associations"
)

lxqt_app_translation_loader(QM_LOADER lxqt-config-file-associations)
lxqt_translate_desktop(DESKTOP_FILES SOURCES lxqt-config-file-associations.desktop.in USE_YAML)

#************************************************

add_executable(lxqt-config-file-associations
    ${CPP_FILES}
    ${QM_FILES}
    ${QM_LOADER}
    ${DESKTOP_FILES}
)

target_link_libraries(lxqt-config-file-associations
    Qt6::Xml
    Qt6::DBus
    Qt6::Widgets
    lxqt
)

install(TARGETS
    lxqt-config-file-associations
    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
    COMPONENT Runtime
)
install(FILES
    ${DESKTOP_FILES}
    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
    COMPONENT Runtime
)
