Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ find_library(libuci NAMES uci)
find_library(libubox NAMES ubox)
find_library(libubus NAMES ubus)
find_library(libblobmsg_json NAMES blobmsg_json)
find_library(libmosquitto NAMES mosquitto)
find_package(ZLIB)
find_library(libmd NAMES libmd.a md)

Expand All @@ -97,6 +98,10 @@ if(libubox)
set(DEFAULT_ULOOP_SUPPORT ON)
endif()

if(libmosquitto AND libubox)
set(DEFAULT_MOSQUITTO_SUPPORT ON)
endif()

if(ZLIB_FOUND)
set(DEFAULT_ZLIB_SUPPORT ON)
endif()
Expand All @@ -120,6 +125,7 @@ option(LOG_SUPPORT "Log plugin support" ON)
option(SOCKET_SUPPORT "Socket plugin support" ON)
option(ZLIB_SUPPORT "Zlib plugin support" ${DEFAULT_ZLIB_SUPPORT})
option(DIGEST_SUPPORT "Digest plugin support" ${DEFAULT_DIGEST_SUPPORT})
option(MOSQUITTO_SUPPORT "Mosquitto MQTT plugin support" ${DEFAULT_MOSQUITTO_SUPPORT})
option(DIGEST_SUPPORT_EXTENDED "Enable additional hash algorithms" ${DEFAULT_DIGEST_SUPPORT})

set(LIB_SEARCH_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/ucode/*.so:${CMAKE_INSTALL_PREFIX}/share/ucode/*.uc:./*.so:./*.uc" CACHE STRING "Default library search path")
Expand Down Expand Up @@ -407,6 +413,18 @@ if(DIGEST_SUPPORT)
target_link_libraries(digest_lib ${libmd})
endif()

if(MOSQUITTO_SUPPORT)
find_path(mosquitto_include_dir NAMES mosquitto.h)
include_directories(${mosquitto_include_dir})
find_path(uloop_include_dir NAMES libubox/uloop.h)
include_directories(${uloop_include_dir})
set(LIBRARIES ${LIBRARIES} mosquitto_lib)
add_library(mosquitto_lib MODULE lib/mosquitto.c)
set_target_properties(mosquitto_lib PROPERTIES OUTPUT_NAME mosquitto PREFIX "")
target_link_options(mosquitto_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS})
target_link_libraries(mosquitto_lib ${libmosquitto} ${libubox})
endif()

if(UNIT_TESTING)
enable_testing()
add_compile_definitions( UNIT_TESTING )
Expand Down
Loading
Loading