cmake_minimum_required(VERSION 3.15)
project(mqtt-client)
#设置mqtt_config相关配置的路径
set(LIB_CONFIG_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/config)
#设置mqtt_log相关路径
set(LIB_LOG_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/log/include)
set(MQTT_LOG mqtt_log)
add_subdirectory(log/source)
#设置mqtt_common相关路径
set(LIB_COMMON_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/common/include)
set(MQTT_COMMON mqtt_common)
add_subdirectory(common/source)
#设置mqtt相关路径
set(LIB_MQTT_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/mqtt/include)
set(MQTT mqtt)
add_subdirectory(mqtt/source)
#设置mqtt_platform相关路径
set(LIB_PLATFORM_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/platform/include)
set(MQTT_PLATFORM mqtt_platform)
add_subdirectory(platform/source)
#设置mqtt_mbedtls相关路径
set(LIB_MBEDTLS_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/mbedtls/include)
set(MQTT_MBEDTLS mqtt_mbedtls)
add_subdirectory(mbedtls)
#设置mqtt_network相关路径
set(LIB_NETWORK_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/network/include)
set(MQTT_NETWORK mqtt_network)
add_subdirectory(network/source)

#设置mqtt_client相关路径
set(LIB_CLIENT_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/mqttclient/include)
set(MQTT_CLIENT mqtt_client)
add_subdirectory(mqttclient/source)


#设置各模块的依赖关系
link_directories(${LIBRARY_OUTPUT_PATH})
target_link_libraries(${MQTT_COMMON} ${MQTT_LOG})
target_link_libraries(${MQTT_PLATFORM} ${MQTT_COMMON})
target_link_libraries(${MQTT_MBEDTLS} ${MQTT_PLATFORM})
target_link_libraries(${MQTT_NETWORK} ${MQTT_MBEDTLS})
target_link_libraries(${MQTT_CLIENT} ${MQTT} ${MQTT_NETWORK} )

#供外部调用的mqtt
add_subdirectory(sys_mqtt/source)
target_link_libraries(${LIB_SYSTEM_MQTT} ${MQTT_CLIENT})