add_library(project_lib STATIC
    projectindex.cpp
    projectindex.h
    symbolindex.cpp
    symbolindex.h
    kateprojectbridge.cpp
    kateprojectbridge.h
    projectindexer.cpp
    projectindexer.h
)
target_link_libraries(project_lib PUBLIC
    Qt6::Core
    Qt6::Concurrent
)
target_include_directories(project_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(Qt6Test_FOUND)
    add_executable(test_projectindex test_projectindex.cpp)
    target_link_libraries(test_projectindex PRIVATE project_lib Qt6::Core Qt6::Test)
    add_test(NAME projectindex COMMAND test_projectindex)

    add_executable(test_symbolindex test_symbolindex.cpp)
    target_link_libraries(test_symbolindex PRIVATE project_lib Qt6::Core Qt6::Test)
    add_test(NAME symbolindex COMMAND test_symbolindex)

    add_executable(test_kateprojectbridge test_kateprojectbridge.cpp)
    target_link_libraries(test_kateprojectbridge PRIVATE project_lib Qt6::Core Qt6::Test)
    add_test(NAME kateprojectbridge COMMAND test_kateprojectbridge)

    add_executable(test_projectindexer test_projectindexer.cpp)
    target_link_libraries(test_projectindexer PRIVATE project_lib Qt6::Core Qt6::Test)
    add_test(NAME projectindexer COMMAND test_projectindexer)
endif()

# Manual benchmark (not a ctest): times the Go-to-File / Go-to-Symbol pipeline
# against a real project root. Build with `cmake --build build --target
# bench_switcher`, run `./build/bin/bench_switcher <root> [metrics-out]`.
add_executable(bench_switcher bench_switcher.cpp)
target_link_libraries(bench_switcher PRIVATE project_lib palette Qt6::Core)
