CMake build fixes, including sqlite support.

pull/2396/merge
Roger A. Light 4 years ago
parent 8d073771c3
commit 6b32cf61b2

@ -48,6 +48,11 @@ else()
set (OPENSSL_INCLUDE_DIR "")
endif()
option(WITH_SQLITE "Include sqlite persistence support?" ON)
if (WITH_SQLITE)
find_package(sqlite3 REQUIRED)
add_definitions("-DWITH_SQLITE")
endif()
option(WITH_UNIX_SOCKETS "Include Unix Domain Socket support?" ON)
if(WITH_UNIX_SOCKETS AND NOT WIN32)

@ -30,6 +30,7 @@ if(WITH_TLS AND CJSON_FOUND)
"${mosquitto_SOURCE_DIR}/include"
"${mosquitto_SOURCE_DIR}/lib"
"${mosquitto_SOURCE_DIR}/plugins/dynamic-security"
"${mosquitto_SOURCE_DIR}/plugins/shared"
"${mosquitto_SOURCE_DIR}/src"
)
if(WITH_BUNDLED_DEPS)

@ -0,0 +1,38 @@
INCLUDE( FindPackageHandleStandardArgs )
# Checks an environment variable; note that the first check
# does not require the usual CMake $-sign.
IF( DEFINED ENV{SQLITE3_DIR} )
SET( SQLITE3_DIR "$ENV{SQLITE3_DIR}" )
ENDIF()
FIND_PATH(
SQLITE3_INCLUDE_DIR
sqlite3.h
HINTS
SQLITE3_DIR
)
FIND_LIBRARY( SQLITE3_LIBRARY
NAMES sqlite3
HINTS ${SQLITE3_DIR}
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS( sqlite3 DEFAULT_MSG
SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY
)
IF( SQLITE3_FOUND )
SET( SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR} )
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY} )
MARK_AS_ADVANCED(
SQLITE3_LIBRARY
SQLITE3_INCLUDE_DIR
SQLITE3_DIR
)
ELSE()
SET( SQLITE3_DIR "" CACHE STRING
"An optional hint to a directory for finding `sqlite3`"
)
ENDIF()

@ -130,6 +130,16 @@ if(WITH_STATIC_LIBRARIES)
target_link_libraries(libmosquitto_static ${LIBRARIES})
target_include_directories(libmosquitto_static PRIVATE
"${OPENSSL_INCLUDE_DIR}"
"${PTHREAD_INCLUDE_DIR}"
"${STDBOOL_H_PATH}"
"${STDINT_H_PATH}"
"${mosquitto_SOURCE_DIR}"
"${mosquitto_SOURCE_DIR}/include"
"${mosquitto_SOURCE_DIR}/lib"
)
set_target_properties(libmosquitto_static PROPERTIES
OUTPUT_NAME mosquitto_static
VERSION ${VERSION}

@ -40,6 +40,14 @@ if(WITH_STATIC_LIBRARIES)
)
endif()
target_include_directories(mosquittopp_static PRIVATE
"${STDBOOL_H_PATH}"
"${STDINT_H_PATH}"
"${mosquitto_SOURCE_DIR}/include"
"${mosquitto_SOURCE_DIR}/lib"
"${mosquitto_SOURCE_DIR}/lib/cpp"
)
target_link_libraries(mosquittopp_static ${LIBRARIES})
set_target_properties(mosquittopp_static PROPERTIES

@ -26,6 +26,7 @@ Contributors:
# include <string.h>
#endif
#include "callbacks.h"
#include "logging_mosq.h"
#include "memory_mosq.h"
#include "mosquitto_internal.h"

@ -1,2 +1,3 @@
add_subdirectory(dynamic-security)
add_subdirectory(persist-sqlite)
add_subdirectory(examples)

@ -198,7 +198,7 @@ if(WITH_WEBSOCKETS)
if(WIN32)
set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
link_directories(${mosquitto_SOURCE_DIR})
endif(IN32)
endif()
else(STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
endif()

Loading…
Cancel
Save