cmake_minimum_required(VERSION 3.10)
project(led_control)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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

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

# 库文件目录
link_directories(${CMAKE_SOURCE_DIR}/lib)

# 查找src目录下所有cpp文件
file(GLOB SOURCES "src/*.cpp")

# 生成可执行文件
add_executable(led_app ${SOURCES})

# 链接需要的库
find_package(Threads REQUIRED)

target_link_libraries(led_app
    PRIVATE
    Threads::Threads
    paho-mqttpp3
    paho-mqtt3as
    ssl
    crypto
)

# 运行时动态库路径设置
set_target_properties(led_app PROPERTIES
    BUILD_RPATH ${CMAKE_SOURCE_DIR}/lib
)
