add_library(deftcommands_lib STATIC
    texttransforms.cpp
    texttransforms.h
    deftcommands.cpp
    deftcommands.h
)
target_link_libraries(deftcommands_lib PUBLIC
    Qt6::Core
    KF6::TextEditor
    KF6::I18n
)
target_include_directories(deftcommands_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(Qt6Test_FOUND)
    add_executable(test_texttransforms test_texttransforms.cpp texttransforms.cpp texttransforms.h)
    target_link_libraries(test_texttransforms PRIVATE Qt6::Core Qt6::Test)
    add_test(NAME texttransforms COMMAND test_texttransforms)

    add_executable(test_deftcommands_live test_deftcommands_live.cpp)
    target_link_libraries(test_deftcommands_live PRIVATE
        deftcommands_lib Qt6::Test KF6::TextEditor)
    add_test(NAME deftcommands_live COMMAND test_deftcommands_live)

    add_executable(test_deftregistration test_deftregistration.cpp)
    target_link_libraries(test_deftregistration PRIVATE
        deftcommands_lib Qt6::Test Qt6::Widgets KF6::TextEditor)
    add_test(NAME deftregistration COMMAND test_deftregistration)
endif()
