This repository was archived by the owner on Nov 29, 2022. It is now read-only.

Description
HI,all
- Thanks for your project providing a effective way to link the paho.mqtt.c in my project with cmake.
- But when I use it in my project, I got the error in link step
/usr/bin/ld: 找不到 -lpaho-mqtt3cs. I would appreciate it if you could give me some guidance
detail information
include(ExternalProject)
find_package(Git REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_search_module(OPENSSL REQUIRED openssl)
ExternalProject_add(
pahomqtt
GIT_REPOSITORY "https://github.com/eclipse/paho.mqtt.c.git"
GIT_TAG "master"
UPDATE_COMMAND ""
PATCH_COMMAND ""
SOURCE_DIR "${CMAKE_BINARY_DIR}/paho-src"
CMAKE_ARGS -DPAHO_WITH_SSL=TRUE -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/paho-build
)
include_directories(${CMAKE_BINARY_DIR}/paho-build/include)
link_directories(${CMAKE_BINARY_DIR}/paho-build/lib)
include(pahomqtt)
add_dependencies(connect pahomqtt)
target_link_libraries(connect PUBLIC paho-mqtt3cs) # connect is a dynamic library name compiled
env
- ubuntu 18.04
- cmake version 3.16.0