2015-01-25 11:52:10 +00:00
|
|
|
# This is a cmake script. Process it with the CMake gui or command line utility
|
|
|
|
# to produce makefiles / Visual Studio project files on Mac OS X and Windows.
|
|
|
|
#
|
|
|
|
# To configure the build options either use the CMake gui, or run the command
|
|
|
|
# line utility including the "-i" option.
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
|
|
|
|
|
|
|
|
project(mosquitto)
|
|
|
|
|
2015-02-17 23:21:14 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2015-02-22 12:20:29 +00:00
|
|
|
# Only for version 3 and up. cmake_policy(SET CMP0042 NEW)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2019-11-28 17:08:11 +00:00
|
|
|
set (VERSION 1.6.8)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2018-01-12 13:41:09 +00:00
|
|
|
add_definitions (-DCMAKE -DVERSION=\"${VERSION}\")
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
2015-02-17 23:21:14 +00:00
|
|
|
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
|
2014-10-26 21:17:08 +00:00
|
|
|
add_definitions("-D_CRT_NONSTDC_NO_DEPRECATE")
|
2014-05-07 22:27:00 +00:00
|
|
|
endif (WIN32)
|
|
|
|
|
2019-04-26 14:51:48 +00:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
option(WITH_TLS
|
|
|
|
"Include SSL/TLS support?" ON)
|
|
|
|
option(WITH_TLS_PSK
|
|
|
|
"Include TLS-PSK support (requires WITH_TLS)?" ON)
|
2014-07-03 21:21:24 +00:00
|
|
|
option(WITH_EC
|
|
|
|
"Include Elliptic Curve support (requires WITH_TLS)?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_TLS)
|
2014-05-07 22:27:00 +00:00
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
add_definitions("-DWITH_TLS")
|
2014-07-03 21:21:24 +00:00
|
|
|
|
2019-02-27 17:31:39 +00:00
|
|
|
if (WITH_TLS_PSK)
|
2014-05-07 22:27:00 +00:00
|
|
|
add_definitions("-DWITH_TLS_PSK")
|
2019-02-27 17:31:39 +00:00
|
|
|
endif (WITH_TLS_PSK)
|
2014-07-03 21:21:24 +00:00
|
|
|
|
2019-02-27 17:31:39 +00:00
|
|
|
if (WITH_EC)
|
2014-07-03 21:21:24 +00:00
|
|
|
add_definitions("-DWITH_EC")
|
2019-02-27 17:31:39 +00:00
|
|
|
endif (WITH_EC)
|
2019-01-10 15:51:34 +00:00
|
|
|
else (WITH_TLS)
|
2014-05-07 22:27:00 +00:00
|
|
|
set (OPENSSL_INCLUDE_DIR "")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_TLS)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
2014-09-29 23:56:57 +00:00
|
|
|
option(WITH_SOCKS "Include SOCKS5 support?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_SOCKS)
|
2014-09-29 23:56:57 +00:00
|
|
|
add_definitions("-DWITH_SOCKS")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_SOCKS)
|
2014-09-29 23:56:57 +00:00
|
|
|
|
2015-09-22 14:28:28 +00:00
|
|
|
option(WITH_SRV "Include SRV lookup support?" OFF)
|
2014-05-19 21:03:26 +00:00
|
|
|
|
2019-08-06 11:01:29 +00:00
|
|
|
option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" OFF)
|
|
|
|
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" OFF)
|
|
|
|
|
2018-10-07 22:16:38 +00:00
|
|
|
option(WITH_THREADING "Include client library threading support?" ON)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (WITH_THREADING)
|
2018-10-07 22:16:38 +00:00
|
|
|
add_definitions("-DWITH_THREADING")
|
|
|
|
if (WIN32)
|
|
|
|
if (CMAKE_CL_64)
|
|
|
|
set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x64\\pthreadVC2.lib)
|
|
|
|
else (CMAKE_CL_64)
|
|
|
|
set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
|
|
|
|
endif (CMAKE_CL_64)
|
|
|
|
set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
|
|
|
|
else (WIN32)
|
|
|
|
find_library(LIBPTHREAD pthread)
|
|
|
|
if (LIBPTHREAD)
|
|
|
|
set (PTHREAD_LIBRARIES pthread)
|
|
|
|
else (LIBPTHREAD)
|
|
|
|
set (PTHREAD_LIBRARIES "")
|
|
|
|
endif()
|
|
|
|
set (PTHREAD_INCLUDE_DIR "")
|
|
|
|
endif (WIN32)
|
2019-01-10 15:51:34 +00:00
|
|
|
else (WITH_THREADING)
|
2018-10-07 22:16:38 +00:00
|
|
|
set (PTHREAD_LIBRARIES "")
|
|
|
|
set (PTHREAD_INCLUDE_DIR "")
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (WITH_THREADING)
|
2018-10-07 22:16:38 +00:00
|
|
|
|
2016-04-19 19:06:01 +00:00
|
|
|
option(DOCUMENTATION "Build documentation?" ON)
|
|
|
|
|
2019-03-02 22:46:47 +00:00
|
|
|
option(WITH_DLT "Include DLT support?" OFF)
|
2018-10-21 14:34:03 +00:00
|
|
|
message(STATUS "WITH_DLT = ${WITH_DLT}")
|
2019-03-02 22:46:47 +00:00
|
|
|
if (WITH_DLT)
|
2018-10-21 14:34:03 +00:00
|
|
|
#find_package(DLT REQUIRED)
|
2019-03-02 22:46:47 +00:00
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules(DLT "automotive-dlt >= 2.11")
|
|
|
|
add_definitions("-DWITH_DLT")
|
|
|
|
endif (WITH_DLT)
|
|
|
|
|
2014-05-07 22:27:00 +00:00
|
|
|
# ========================================
|
|
|
|
# Include projects
|
|
|
|
# ========================================
|
|
|
|
|
|
|
|
add_subdirectory(lib)
|
|
|
|
add_subdirectory(client)
|
|
|
|
add_subdirectory(src)
|
2019-01-10 15:51:34 +00:00
|
|
|
if (DOCUMENTATION)
|
2016-04-19 19:06:01 +00:00
|
|
|
add_subdirectory(man)
|
2019-01-10 15:51:34 +00:00
|
|
|
endif (DOCUMENTATION)
|
2014-05-07 22:27:00 +00:00
|
|
|
|
|
|
|
# ========================================
|
|
|
|
# Install config file
|
|
|
|
# ========================================
|
|
|
|
|
2019-04-26 14:51:48 +00:00
|
|
|
install(FILES mosquitto.conf aclfile.example pskfile.example pwfile.example DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/mosquitto")
|
2016-03-12 20:29:32 +00:00
|
|
|
|
2016-09-10 20:48:50 +00:00
|
|
|
|
|
|
|
# ========================================
|
|
|
|
# Install pkg-config files
|
|
|
|
# ========================================
|
|
|
|
|
|
|
|
configure_file(libmosquitto.pc.in libmosquitto.pc @ONLY)
|
2019-07-02 16:36:41 +00:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquitto.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
2016-09-10 20:48:50 +00:00
|
|
|
configure_file(libmosquittopp.pc.in libmosquittopp.pc @ONLY)
|
2019-07-02 16:36:41 +00:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquittopp.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
2016-09-10 20:48:50 +00:00
|
|
|
|
2016-03-12 20:29:32 +00:00
|
|
|
# ========================================
|
|
|
|
# Testing
|
|
|
|
# ========================================
|
2019-04-26 11:37:15 +00:00
|
|
|
enable_testing()
|