1. 下载
git clone https://github.com/eclipse/paho.mqtt.c
2. 编译
a. 在 cmake/ 下创建一个自己的 交叉编译链 cmake 文件 toolchain.linux-aaa.cmake
# path to compiler and utilities
# specify the cross compiler
SET(CMAKE_C_COMPILER aaa-gnu-gcc)
SET(CMAKE_CXX_COMPILER aaa-gnu-g++)
SET(CMAKE_INSTALL_PREFIX /work/MQTT/paho.mqtt.c/build/output)
# Name of the target platform
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR aaa)
#openssl
SET(OPENSSL_ROOT_DIR /work/MQTT/openssl-1.1.1g-libs/Bin)
SET(OPENSSL_LIBRARIES /work/MQTT/openssl-1.1.1g-libs/Bin/lib)
SET(OPENSSL_INCLUDE_DIR /work/MQTT/openssl-1.1.1g-libs/Bin/include)
# Version of the system
SET(CMAKE_SYSTEM_VERSION 1)
非交叉编译版本
# path to compiler and utilities
# specify the cross compiler
#SET(CMAKE_C_COMPILER aaa-gnu-gcc)
#SET(CMAKE_CXX_COMPILER aaa-gnu-g++)
SET(CMAKE_INSTALL_PREFIX /work/MQTT/paho.mqtt.c/build-gcc/output)
# Name of the target platform
#S