cmake_minimum_required(VERSION 3.16)
project(lzt_sniper_cpp CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif()

find_package(CURL REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(Threads REQUIRED)

# --- D++ (Discord library) -------------------------------------------------
# Prefer a system/pre-built install (e.g. built once and `make install`-ed,
# or a distro package if your platform has one). Falls back to fetching and
# building it from source the first time you configure the project.
find_package(DPP QUIET)
if(NOT DPP_FOUND)
    include(FetchContent)
    FetchContent_Declare(
        DPP
        GIT_REPOSITORY https://github.com/brainboxdotcc/DPP.git
        GIT_TAG        v10.0.35
        GIT_SHALLOW    TRUE
    )
    FetchContent_MakeAvailable(DPP)
endif()

add_executable(lzt_sniper
    src/main.cpp
    src/Config.cpp
    src/Logger.cpp
    src/State.cpp
    src/HttpClient.cpp
    src/Scraper.cpp
    src/DiscordNotifier.cpp
    src/SniperEngine.cpp
    src/DiscordBot.cpp
)

target_include_directories(lzt_sniper PRIVATE include)
target_link_libraries(lzt_sniper PRIVATE
    CURL::libcurl
    nlohmann_json::nlohmann_json
    Threads::Threads
    dpp
)
