cmake_minimum_required(VERSION 3.10)
project(mqtt_client)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 设置可执行文件输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)

# 包含头文件目录
include_directories(
    ${CMAKE_SOURCE_DIR}/include
    ${CMAKE_SOURCE_DIR}/include/paho_mqtt
)

link_directories(${CMAKE_SOURCE_DIR}/lib/x86)

# 源文件列表
set(SOURCES
    src/main.cpp
    src/config/mqtt_config.cpp
    src/data/protocol_codec.cpp
    src/log/logger.cpp
    src/tcp/tcp_client.cpp
    src/mqtt/mqtt_client.cpp
    src/mqtt/mqtt_client_wrapper.cpp
    src/tcp/tcp_thread/broadcast_client.cpp
    src/tcp/tcp_thread/mqtt_config_client.cpp
    src/tcp/tcp_thread/uplink_data_client.cpp
    src/tcp/tcp_thread/uplink_notify_client.cpp
)

# 创建可执行文件
add_executable(${PROJECT_NAME} ${SOURCES})

target_link_libraries(mqtt_client 
    pthread
    libpaho-mqttpp3.a
    libpaho-mqtt3as.a
    ssl
    crypto
    dl
)

