kde_enable_exceptions()


add_library(kde_grantlee_plugin MODULE)
target_sources(kde_grantlee_plugin PRIVATE
    kdegrantleeplugin.cpp
    color.cpp
    colorscheme.cpp
    icon.cpp
    palette.cpp

    kdegrantleeplugin.h
    color.h
    colorscheme.h
    icon.h
    palette.h
    )

if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
    set_target_properties(kde_grantlee_plugin PROPERTIES UNITY_BUILD ON)
endif()
kpim_grantlee_adjust_plugin_name(kde_grantlee_plugin)
target_link_libraries(kde_grantlee_plugin
    ${MAIN_LIB}
    KF${KF_MAJOR_VERSION}::IconThemes
    KF${KF_MAJOR_VERSION}::GuiAddons
    KF${KF_MAJOR_VERSION}::ConfigWidgets
)

if (QT_MAJOR_VERSION STREQUAL "5")
install(TARGETS kde_grantlee_plugin
        LIBRARY DESTINATION ${KDE_INSTALL_LIBDIR}/grantlee/${Grantlee5_VERSION_MAJOR}.${Grantlee5_VERSION_MINOR}/
)
else()
    install(TARGETS kde_grantlee_plugin
            LIBRARY DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/ktexttemplate/
    )
endif()
