2014-05-07 22:27:00 +00:00
|
|
|
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/src
|
|
|
|
${mosquitto_SOURCE_DIR}/lib ${OPENSSL_INCLUDE_DIR}
|
|
|
|
${STDBOOL_H_PATH} ${STDINT_H_PATH})
|
|
|
|
|
|
|
|
set (MOSQ_SRCS
|
|
|
|
conf.c
|
2017-02-19 20:29:04 +00:00
|
|
|
conf_includedir.c
|
2014-05-07 22:27:00 +00:00
|
|
|
context.c
|
|
|
|
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
|
|
|
|
../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
|
2014-05-07 22:27:00 +00:00
|
|
|
lib_load.h
|
|
|
|
logging.c
|
|
|
|
loop.c
|
|
|
|
../lib/memory_mosq.c ../lib/memory_mosq.h
|
|
|
|
mosquitto.c
|
2016-07-08 09:32:20 +00:00
|
|
|
mosquitto_broker.h mosquitto_broker_internal.h
|
2014-05-07 22:27:00 +00:00
|
|
|
net.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
|
2014-05-07 22:27:00 +00:00
|
|
|
persist.c persist.h
|
2017-02-22 11:39:24 +00:00
|
|
|
plugin.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
|
2014-05-07 22:27:00 +00:00
|
|
|
subs.c
|
|
|
|
security.c security_default.c
|
|
|
|
../lib/send_mosq.c ../lib/send_mosq.h
|
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
|
|
|
|
../lib/send_unsubscribe.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
|
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
|
2014-05-07 22:27:00 +00:00
|
|
|
../lib/will_mosq.c ../lib/will_mosq.h)
|
|
|
|
|
2016-03-06 22:30:17 +00:00
|
|
|
|
2018-09-08 09:24:12 +00:00
|
|
|
option(WITH_BUNDLED_DEPS "Build with bundled dependencies?" ON)
|
|
|
|
if (${WITH_BUNDLED_DEPS} STREQUAL ON)
|
|
|
|
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/src/deps)
|
|
|
|
endif (${WITH_BUNDLED_DEPS} STREQUAL ON)
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
option(INC_BRIDGE_SUPPORT
|
|
|
|
"Include bridge support for connecting to other brokers?" ON)
|
|
|
|
if (${INC_BRIDGE_SUPPORT} STREQUAL ON)
|
|
|
|
set (MOSQ_SRCS ${MOSQ_SRCS} bridge.c)
|
|
|
|
add_definitions("-DWITH_BRIDGE")
|
|
|
|
endif (${INC_BRIDGE_SUPPORT} STREQUAL ON)
|
|
|
|
|
|
|
|
|
|
|
|
option(USE_LIBWRAP
|
|
|
|
"Include tcp-wrappers support?" OFF)
|
|
|
|
|
|
|
|
if (${USE_LIBWRAP} STREQUAL ON)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} wrap)
|
|
|
|
add_definitions("-DWITH_WRAP")
|
|
|
|
endif (${USE_LIBWRAP} STREQUAL ON)
|
|
|
|
|
|
|
|
option(INC_DB_UPGRADE
|
|
|
|
"Include database upgrade support? (recommended)" ON)
|
|
|
|
|
|
|
|
option(INC_MEMTRACK
|
|
|
|
"Include memory tracking support?" ON)
|
|
|
|
if (${INC_MEMTRACK} STREQUAL ON)
|
|
|
|
add_definitions("-DWITH_MEMORY_TRACKING")
|
|
|
|
endif (${INC_MEMTRACK} STREQUAL ON)
|
|
|
|
|
|
|
|
option(WITH_PERSISTENCE
|
|
|
|
"Include persistence support?" ON)
|
|
|
|
if (${WITH_PERSISTENCE} STREQUAL ON)
|
|
|
|
add_definitions("-DWITH_PERSISTENCE")
|
|
|
|
endif (${WITH_PERSISTENCE} STREQUAL ON)
|
|
|
|
|
|
|
|
option(WITH_SYS_TREE
|
|
|
|
"Include $SYS tree support?" ON)
|
|
|
|
if (${WITH_SYS_TREE} STREQUAL ON)
|
|
|
|
add_definitions("-DWITH_SYS_TREE")
|
|
|
|
endif (${WITH_SYS_TREE} STREQUAL ON)
|
|
|
|
|
2015-06-22 18:11:17 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
option(WITH_SYSTEMD
|
|
|
|
"Include systemd support?" OFF)
|
|
|
|
if (${WITH_SYSTEMD} STREQUAL ON)
|
|
|
|
add_definitions("-DWITH_SYSTEMD")
|
|
|
|
find_library(SYSTEMD_LIBRARY systemd)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${SYSTEMD_LIBRARY})
|
|
|
|
endif (${WITH_SYSTEMD} STREQUAL ON)
|
|
|
|
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)
|
|
|
|
if (${WITH_WEBSOCKETS} STREQUAL ON )
|
2014-05-06 09:47:00 +00:00
|
|
|
add_definitions("-DWITH_WEBSOCKETS")
|
|
|
|
endif (${WITH_WEBSOCKETS} STREQUAL ON)
|
|
|
|
|
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)
|
|
|
|
|
2015-01-07 22:18:39 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${OPENSSL_LIBRARIES})
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2017-02-08 16:24:50 +00:00
|
|
|
# Check for getaddrinfo_a
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
check_library_exists(anl getaddrinfo_a "" HAVE_GETADDRINFO_A)
|
|
|
|
if (HAVE_GETADDRINFO_A)
|
|
|
|
add_definitions(-DHAVE_GETADDRINFO_A)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} anl)
|
|
|
|
endif (HAVE_GETADDRINFO_A)
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
if (UNIX)
|
|
|
|
if (APPLE)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
|
|
|
else (APPLE)
|
2017-01-24 22:01:16 +00:00
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
|
|
|
find_library(LIBRT rt)
|
|
|
|
if (LIBRT)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} rt)
|
|
|
|
endif (LIBRT)
|
2014-05-07 22:27:00 +00:00
|
|
|
endif (APPLE)
|
|
|
|
endif (UNIX)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2014-05-06 09:47:00 +00:00
|
|
|
if (${WITH_WEBSOCKETS} STREQUAL ON)
|
2018-08-16 10:28:26 +00:00
|
|
|
if (${STATIC_WEBSOCKETS} STREQUAL ON)
|
|
|
|
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)
|
2018-08-16 10:28:26 +00:00
|
|
|
else (${STATIC_WEBSOCKETS} STREQUAL ON)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
|
|
|
|
endif (${STATIC_WEBSOCKETS} STREQUAL ON)
|
2014-05-06 09:47:00 +00:00
|
|
|
endif (${WITH_WEBSOCKETS} STREQUAL ON)
|
|
|
|
|
2014-06-15 00:07:05 +00:00
|
|
|
# Simple detect libuuid
|
2015-02-17 23:21:14 +00:00
|
|
|
if(NOT APPLE)
|
|
|
|
FIND_PATH(UUID_HEADER uuid/uuid.h)
|
|
|
|
if (UUID_HEADER)
|
|
|
|
add_definitions(-DWITH_UUID)
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} uuid)
|
|
|
|
endif (UUID_HEADER)
|
|
|
|
endif(NOT APPLE)
|
2014-06-15 00:07:05 +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})
|
|
|
|
|
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)
|
|
|
|
|
2016-03-13 20:33:08 +00:00
|
|
|
install(TARGETS mosquitto RUNTIME DESTINATION "${SBINDIR}" LIBRARY DESTINATION "${LIBDIR}")
|
2016-07-08 09:32:20 +00:00
|
|
|
install(FILES mosquitto_broker.h mosquitto_plugin.h DESTINATION "${INCLUDEDIR}")
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
if (${WITH_TLS} STREQUAL ON)
|
|
|
|
add_executable(mosquitto_passwd mosquitto_passwd.c)
|
2018-03-23 10:28:22 +00:00
|
|
|
target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES})
|
2016-03-13 20:33:08 +00:00
|
|
|
install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
|
2014-05-07 22:27:00 +00:00
|
|
|
endif (${WITH_TLS} STREQUAL ON)
|
|
|
|
|
2016-04-19 19:08:02 +00:00
|
|
|
if (UNIX AND NOT APPLE)
|
2014-05-07 22:27:00 +00:00
|
|
|
install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
|
2016-04-19 19:08:02 +00:00
|
|
|
endif (UNIX AND NOT APPLE)
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
|