2014-05-07 22:27:00 +00:00
|
|
|
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/src
|
2020-10-13 14:52:01 +00:00
|
|
|
${mosquitto_SOURCE_DIR}/include ${mosquitto_SOURCE_DIR}/lib
|
|
|
|
${OPENSSL_INCLUDE_DIR} ${STDBOOL_H_PATH} ${STDINT_H_PATH})
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
set (MOSQ_SRCS
|
2019-03-05 14:01:29 +00:00
|
|
|
../lib/alias_mosq.c ../lib/alias_mosq.h
|
2019-10-08 19:56:56 +00:00
|
|
|
bridge.c bridge_topic.c
|
2014-05-07 22:27:00 +00:00
|
|
|
conf.c
|
2017-02-19 20:29:04 +00:00
|
|
|
conf_includedir.c
|
2014-05-07 22:27:00 +00:00
|
|
|
context.c
|
2020-08-04 10:51:55 +00:00
|
|
|
control.c
|
2014-05-07 22:27:00 +00:00
|
|
|
database.c
|
2018-10-25 11:44:41 +00:00
|
|
|
handle_auth.c
|
2016-03-06 22:30:17 +00:00
|
|
|
handle_connack.c
|
|
|
|
handle_connect.c
|
2019-04-02 09:56:17 +00:00
|
|
|
handle_disconnect.c
|
2016-03-06 22:30:17 +00:00
|
|
|
../lib/handle_ping.c
|
|
|
|
../lib/handle_pubackcomp.c
|
|
|
|
handle_publish.c
|
|
|
|
../lib/handle_pubrec.c
|
|
|
|
../lib/handle_pubrel.c
|
|
|
|
../lib/handle_suback.c
|
|
|
|
handle_subscribe.c
|
|
|
|
../lib/handle_unsuback.c
|
|
|
|
handle_unsubscribe.c
|
2020-09-05 21:59:50 +00:00
|
|
|
keepalive.c
|
2014-05-07 22:27:00 +00:00
|
|
|
lib_load.h
|
|
|
|
logging.c
|
|
|
|
loop.c
|
|
|
|
../lib/memory_mosq.c ../lib/memory_mosq.h
|
2020-09-22 10:19:05 +00:00
|
|
|
memory_public.c
|
2014-05-07 22:27:00 +00:00
|
|
|
mosquitto.c
|
2020-10-07 21:04:15 +00:00
|
|
|
../include/mosquitto_broker.h mosquitto_broker_internal.h
|
2020-02-04 16:05:58 +00:00
|
|
|
../lib/misc_mosq.c ../lib/misc_mosq.h
|
2020-02-15 14:49:53 +00:00
|
|
|
mux.c mux.h mux_epoll.c mux_poll.c
|
2014-05-07 22:27:00 +00:00
|
|
|
net.c
|
2017-06-09 13:52:50 +00:00
|
|
|
../lib/net_mosq_ocsp.c ../lib/net_mosq.c ../lib/net_mosq.h
|
2018-10-03 09:23:58 +00:00
|
|
|
../lib/packet_datatypes.c
|
2015-05-16 13:16:40 +00:00
|
|
|
../lib/packet_mosq.c ../lib/packet_mosq.h
|
2020-10-13 14:52:01 +00:00
|
|
|
password_mosq.c password_mosq.h
|
2019-03-20 00:02:38 +00:00
|
|
|
persist_read_v234.c persist_read_v5.c persist_read.c
|
|
|
|
persist_write_v5.c persist_write.c
|
2019-03-19 16:26:29 +00:00
|
|
|
persist.h
|
2020-09-22 10:19:05 +00:00
|
|
|
plugin.c plugin_public.c
|
2018-11-27 12:23:21 +00:00
|
|
|
property_broker.c
|
2018-10-02 15:27:40 +00:00
|
|
|
../lib/property_mosq.c ../lib/property_mosq.h
|
2016-03-06 22:30:17 +00:00
|
|
|
read_handle.c
|
|
|
|
../lib/read_handle.h
|
2019-05-14 12:24:46 +00:00
|
|
|
retain.c
|
2014-05-07 22:27:00 +00:00
|
|
|
security.c security_default.c
|
|
|
|
../lib/send_mosq.c ../lib/send_mosq.h
|
2019-04-04 21:08:55 +00:00
|
|
|
send_auth.c
|
2016-03-06 22:30:17 +00:00
|
|
|
send_connack.c
|
|
|
|
../lib/send_connect.c
|
|
|
|
../lib/send_disconnect.c
|
|
|
|
../lib/send_publish.c
|
|
|
|
send_suback.c
|
2016-07-03 21:40:27 +00:00
|
|
|
signals.c
|
2016-03-06 22:30:17 +00:00
|
|
|
../lib/send_subscribe.c
|
2018-10-31 12:38:39 +00:00
|
|
|
send_unsuback.c
|
2016-03-06 22:30:17 +00:00
|
|
|
../lib/send_unsubscribe.c
|
2019-03-06 14:47:16 +00:00
|
|
|
session_expiry.c
|
2020-12-01 15:57:37 +00:00
|
|
|
../lib/strings_mosq.c
|
2019-03-06 14:47:16 +00:00
|
|
|
subs.c
|
2015-05-16 13:16:40 +00:00
|
|
|
sys_tree.c sys_tree.h
|
2014-05-07 22:27:00 +00:00
|
|
|
../lib/time_mosq.c
|
|
|
|
../lib/tls_mosq.c
|
2019-05-14 12:24:46 +00:00
|
|
|
topic_tok.c
|
2018-10-16 12:49:38 +00:00
|
|
|
../lib/util_mosq.c ../lib/util_topic.c ../lib/util_mosq.h
|
2016-06-21 16:05:33 +00:00
|
|
|
../lib/utf8_mosq.c
|
2014-05-06 09:47:00 +00:00
|
|
|
websockets.c
|
2019-03-05 14:01:29 +00:00
|
|
|
will_delay.c
|
2014-05-07 22:27:00 +00:00
|
|
|
../lib/will_mosq.c ../lib/will_mosq.h)
|
|
|
|
|
2016-03-06 22:30:17 +00:00
|
|
|
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_BUNDLED_DEPS)
|
2020-10-13 14:52:01 +00:00
|
|
|
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/deps)
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_BUNDLED_DEPS)
|
2018-09-08 09:24:12 +00:00
|
|
|
|
2021-03-08 23:57:04 +00:00
|
|
|
find_path(HAVE_SYS_EPOLL_H sys/epoll.h)
|
|
|
|
if (HAVE_SYS_EPOLL_H)
|
|
|
|
add_definitions("-DWITH_EPOLL")
|
|
|
|
endif()
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
option(INC_BRIDGE_SUPPORT
|
|
|
|
"Include bridge support for connecting to other brokers?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (INC_BRIDGE_SUPPORT)
|
2014-05-07 22:27:00 +00:00
|
|
|
set (MOSQ_SRCS ${MOSQ_SRCS} bridge.c)
|
|
|
|
add_definitions("-DWITH_BRIDGE")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (INC_BRIDGE_SUPPORT)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
option(USE_LIBWRAP
|
|
|
|
"Include tcp-wrappers support?" OFF)
|
|
|
|
|
2019-01-10 15:51:34 +00:00
|
|
|
if (USE_LIBWRAP)
|
2014-05-07 22:27:00 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} wrap)
|
|
|
|
add_definitions("-DWITH_WRAP")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (USE_LIBWRAP)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
option(INC_DB_UPGRADE
|
|
|
|
"Include database upgrade support? (recommended)" ON)
|
|
|
|
|
|
|
|
option(INC_MEMTRACK
|
|
|
|
"Include memory tracking support?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (INC_MEMTRACK)
|
2014-05-07 22:27:00 +00:00
|
|
|
add_definitions("-DWITH_MEMORY_TRACKING")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (INC_MEMTRACK)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
option(WITH_PERSISTENCE
|
|
|
|
"Include persistence support?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_PERSISTENCE)
|
2014-05-07 22:27:00 +00:00
|
|
|
add_definitions("-DWITH_PERSISTENCE")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_PERSISTENCE)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
option(WITH_SYS_TREE
|
|
|
|
"Include $SYS tree support?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_SYS_TREE)
|
2014-05-07 22:27:00 +00:00
|
|
|
add_definitions("-DWITH_SYS_TREE")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_SYS_TREE)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2020-01-22 11:29:41 +00:00
|
|
|
option(WITH_ADNS
|
|
|
|
"Include ADNS support?" OFF)
|
|
|
|
|
2015-06-22 18:11:17 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
option(WITH_SYSTEMD
|
|
|
|
"Include systemd support?" OFF)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_SYSTEMD)
|
2015-06-22 18:11:17 +00:00
|
|
|
add_definitions("-DWITH_SYSTEMD")
|
|
|
|
find_library(SYSTEMD_LIBRARY systemd)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${SYSTEMD_LIBRARY})
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_SYSTEMD)
|
2015-06-22 18:11:17 +00:00
|
|
|
endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
|
2018-08-16 10:28:26 +00:00
|
|
|
option(WITH_WEBSOCKETS "Include websockets support?" OFF)
|
|
|
|
option(STATIC_WEBSOCKETS "Use the static libwebsockets library?" OFF)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_WEBSOCKETS)
|
2020-12-01 11:05:47 +00:00
|
|
|
find_package(libwebsockets)
|
2014-05-06 09:47:00 +00:00
|
|
|
add_definitions("-DWITH_WEBSOCKETS")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_WEBSOCKETS)
|
2014-05-06 09:47:00 +00:00
|
|
|
|
2020-12-02 19:44:46 +00:00
|
|
|
option(WITH_CONTROL "Include $CONTROL topic support?" ON)
|
|
|
|
if (WITH_CONTROL)
|
|
|
|
add_definitions("-DWITH_CONTROL")
|
|
|
|
endif (WITH_CONTROL)
|
|
|
|
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
if (WIN32 OR CYGWIN)
|
|
|
|
set (MOSQ_SRCS ${MOSQ_SRCS} service.c)
|
|
|
|
endif (WIN32 OR CYGWIN)
|
|
|
|
|
|
|
|
add_definitions (-DWITH_BROKER)
|
|
|
|
|
2019-03-02 22:46:47 +00:00
|
|
|
if (WITH_DLT)
|
2018-10-21 14:34:03 +00:00
|
|
|
message(STATUS "DLT_LIBDIR = ${DLT_LIBDIR}")
|
|
|
|
link_directories(${DLT_LIBDIR})
|
2020-01-22 11:31:01 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${DLT_LIBRARIES})
|
2019-03-02 22:46:47 +00:00
|
|
|
endif (WITH_DLT)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2018-10-21 14:34:03 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${OPENSSL_LIBRARIES})
|
2017-02-08 16:24:50 +00:00
|
|
|
# Check for getaddrinfo_a
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
check_library_exists(anl getaddrinfo_a "" HAVE_GETADDRINFO_A)
|
2020-01-22 11:29:41 +00:00
|
|
|
if (HAVE_GETADDRINFO_A AND WITH_ADNS)
|
|
|
|
add_definitions("-DWITH_ADNS")
|
2017-02-08 16:24:50 +00:00
|
|
|
add_definitions(-DHAVE_GETADDRINFO_A)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} anl)
|
2020-01-22 11:29:41 +00:00
|
|
|
endif (HAVE_GETADDRINFO_A AND WITH_ADNS)
|
2017-02-08 16:24:50 +00:00
|
|
|
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
if (UNIX)
|
|
|
|
if (APPLE)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
2020-06-10 07:33:57 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} m)
|
2020-08-11 15:12:18 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} m)
|
2021-07-07 12:26:20 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} m network)
|
2018-10-02 11:06:36 +00:00
|
|
|
elseif(QNX)
|
|
|
|
set(MOSQ_LIBS ${MOSQ_LIBS} m socket)
|
|
|
|
else(APPLE)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
|
|
|
find_library(LIBRT rt)
|
|
|
|
if (LIBRT)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} rt)
|
|
|
|
endif (LIBRT)
|
|
|
|
endif (APPLE)
|
2014-05-07 22:27:00 +00:00
|
|
|
endif (UNIX)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_WEBSOCKETS)
|
|
|
|
if (STATIC_WEBSOCKETS)
|
2018-08-16 10:28:26 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static)
|
2018-08-16 12:26:58 +00:00
|
|
|
if (WIN32)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
|
|
|
|
link_directories(${mosquitto_SOURCE_DIR})
|
|
|
|
endif (WIN32)
|
2019-01-10 15:51:34 +00:00
|
|
|
else (STATIC_WEBSOCKETS)
|
2018-08-16 10:28:26 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (STATIC_WEBSOCKETS)
|
|
|
|
endif (WITH_WEBSOCKETS)
|
2014-05-06 09:47:00 +00:00
|
|
|
|
2018-08-16 12:26:58 +00:00
|
|
|
add_executable(mosquitto ${MOSQ_SRCS})
|
2014-05-07 22:27:00 +00:00
|
|
|
target_link_libraries(mosquitto ${MOSQ_LIBS})
|
2020-09-30 09:21:26 +00:00
|
|
|
if (WIN32)
|
|
|
|
set_target_properties(mosquitto PROPERTIES ENABLE_EXPORTS 1)
|
|
|
|
endif (WIN32)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2015-02-17 23:21:14 +00:00
|
|
|
if (UNIX)
|
|
|
|
if (APPLE)
|
|
|
|
set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker-macosx.syms")
|
|
|
|
else (APPLE)
|
2015-02-22 12:20:29 +00:00
|
|
|
set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-dynamic-list=${mosquitto_SOURCE_DIR}/src/linker.syms")
|
2015-02-17 23:21:14 +00:00
|
|
|
endif (APPLE)
|
|
|
|
endif (UNIX)
|
|
|
|
|
2019-04-26 14:51:48 +00:00
|
|
|
install(TARGETS mosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_SBINDIR}")
|
2020-10-07 21:04:15 +00:00
|
|
|
install(FILES ../include/mosquitto_broker.h ../include/mosquitto_plugin.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|