cmake_minimum_required(VERSION 3.21)

# ============================================================
# plugin-lsp — LSP (Language Server Protocol) 服务
# 自行管理子进程，无外部服务依赖
# ============================================================

add_library(plugin-lsp SHARED
    src/lsp_plugin.cpp
)

target_link_libraries(plugin-lsp PRIVATE dstalk)

# Boost.JSON 用于 JSON-RPC 消息构建/解析
find_package(Boost REQUIRED CONFIG)
target_link_libraries(plugin-lsp PRIVATE boost::boost dstalk_boost_config)

# POSIX 平台需要 pthread (用于 std::thread)
if(NOT WIN32)
    find_package(Threads REQUIRED)
    target_link_libraries(plugin-lsp PRIVATE Threads::Threads)
endif()

set_target_properties(plugin-lsp PROPERTIES
    PREFIX ""
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins"
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins"
)
