EdgeGateway_FSU/DevicePortGet/Mqtt_src/CMakeLists.txt

56 lines
2.8 KiB
CMake

#*******************************************************************************
# Copyright © ALIENTEK Co., Ltd. 1998-2021. All rights reserved.
#
# 顶层CMakeLists.txt
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# and Eclipse Distribution License v1.0 which accompany this distribution.
#*******************************************************************************/
#cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
project(MQTTClient C)
message(STATUS "MQTTClient CMake version: " ${CMAKE_VERSION})
message(STATUS "MQTTClient CMake system name: " ${CMAKE_SYSTEM_NAME})
message(STATUS "MQTTClient CMake system processor: " ${CMAKE_SYSTEM_PROCESSOR})
#获取绝对路径 后面会使用 kooloo add 202311
get_filename_component(DIR_ONE_ABOVE ../ ABSOLUTE)
message(STATUS ${DIR_ONE_ABOVE})
# 设置可执行文件输出路径
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#include_directories (Public_Src Public_Src_LISTo)
include_directories ("Public_Src/cjson")
#include_directories ("Src")
# 定义源文件变量 kooloo add 202310
SET(SRC_LIST
MqttClient.c
../src/DebugPrint.c
../src/public.c
../src/mslog/mslog.c
../Public_Src/ProcessisRunning.c
../Public_Src/SystemTimeFunc.c
../Public_Src/cjson/cJSON.c
../Public_Src/CjsonCreate_Init.c #新增 20240312
../src/sqTable_init.c
../src/sqlite_api.c
)
# 定义可执行文件目标
add_executable(MqttClientApp ${SRC_LIST} ${Public_Src_LISTo})
#添加编译尾缀 kooloo add 202311
TARGET_LINK_LIBRARIES(MqttClientApp PRIVATE dl)
TARGET_LINK_LIBRARIES(MqttClientApp PRIVATE rt)
# 指定MQTT客户端库头文件路径、库路径以及链接库
# ***大家需要根据MQTT的实际安装路径设置***
#target_include_directories(MqttClientApp PRIVATE /home/alientek/linux/tool/paho.mqtt.c-1.3.12/install/include)#MQTT头文件搜索路径
#target_link_directories(MqttClientApp PRIVATE /home/alientek/linux/tool/paho.mqtt.c-1.3.12/install/lib) #MQTT库文件搜索路径
#target_include_directories(MqttClientApp PRIVATE ../lib/paho.mqtt.c-1.3.12/install/include)#MQTT头文件搜索路径
#target_link_directories(MqttClientApp PRIVATE lib/paho.mqtt.c-1.3.12/install/lib) #MQTT库文件搜索路径
target_link_libraries(MqttClientApp PRIVATE paho-mqtt3c) #MQTT链接库 libpaho-mqtt3c.so
#使用绝对路径,相对路径 先获取后再使用 直接使用绝对路径后面如果变更路径会出错 kooloo add 202311
TARGET_LINK_LIBRARIES(MqttClientApp PRIVATE ${DIR_ONE_ABOVE}/lib/sqlite3/lib/libsqlite3.so)
#TARGET_LINK_LIBRARIES(MqttClientApp PRIVATE /home/alientek/Desktop/test_arm_no/EdgeGateway_FSU/DevicePortGet/lib/sqlite3/lib/libsqlite3.so)