function(add_share_plugin name)
    kcoreaddons_add_plugin(${name} SOURCES ${ARGN} INSTALL_NAMESPACE "kf6/purpose")
    target_link_libraries(${name} Qt6::Core KF6::Purpose)
    set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf6/purpose")

    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${name}_config.qml")
        install(FILES "${name}_config.qml" DESTINATION ${KDE_INSTALL_DATADIR_KF}/purpose)
    endif()
endfunction()

add_subdirectory(saveas)
add_subdirectory(imgur)
add_subdirectory(pastebin)
if (KAccounts6_FOUND)
    add_subdirectory(youtube)
    add_subdirectory(nextcloud)
endif()
add_subdirectory(kdeconnect)
add_subdirectory(reviewboard)
add_subdirectory(phabricator)
add_subdirectory(email)
add_subdirectory(telegram)
add_subdirectory(kdeconnect_sms)
add_subdirectory(barcode)
add_subdirectory(twitter)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    add_subdirectory(bluetooth)
endif()
