mosquitto/lib/CMakeLists.txt

96 lines
2.4 KiB
CMake
Raw Normal View History

2014-05-07 22:27:00 +00:00
add_subdirectory(cpp)
option(WITH_THREADING "Include client library threading support?" ON)
if (${WITH_THREADING} STREQUAL ON)
add_definitions("-DWITH_THREADING")
if (WIN32)
2015-09-22 12:48:36 +00:00
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)
2014-05-07 22:27:00 +00:00
set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
else (WIN32)
set (PTHREAD_LIBRARIES pthread)
set (PTHREAD_INCLUDE_DIR "")
endif (WIN32)
else (${WITH_THREADING} STREQUAL ON)
set (PTHREAD_LIBRARIES "")
set (PTHREAD_INCLUDE_DIR "")
endif (${WITH_THREADING} STREQUAL ON)
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/lib
${STDBOOL_H_PATH} ${STDINT_H_PATH}
${OPENSSL_INCLUDE_DIR} ${PTHREAD_INCLUDE_DIR})
link_directories(${mosquitto_SOURCE_DIR}/lib)
add_library(libmosquitto SHARED
handle_connack.c
handle_ping.c
handle_pubackcomp.c
handle_publish.c
handle_pubrec.c
handle_pubrel.c
handle_suback.c
handle_unsuback.c
2016-01-26 09:26:17 +00:00
helpers.c
2014-05-07 22:27:00 +00:00
logging_mosq.c logging_mosq.h
memory_mosq.c memory_mosq.h
messages_mosq.c messages_mosq.h
mosquitto.c mosquitto.h
mosquitto_internal.h
mqtt3_protocol.h
net_mosq.c net_mosq.h
2015-04-29 20:23:59 +00:00
packet_mosq.c packet_mosq.h
2014-05-07 22:27:00 +00:00
read_handle.c read_handle.h
send_connect.c
send_disconnect.c
send_mosq.c
send_publish.c
send_subscribe.c
send_unsubscribe.c
2014-05-07 22:27:00 +00:00
send_mosq.c send_mosq.h
socks_mosq.c
2014-05-07 22:27:00 +00:00
srv_mosq.c
thread_mosq.c
time_mosq.c
tls_mosq.c
util_mosq.c util_mosq.h
will_mosq.c will_mosq.h)
set (LIBRARIES ${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES})
if (UNIX AND NOT APPLE)
set (LIBRARIES ${LIBRARIES} rt)
endif (UNIX AND NOT APPLE)
if (WIN32)
set (LIBRARIES ${LIBRARIES} ws2_32)
endif (WIN32)
if (${WITH_SRV} STREQUAL ON)
2014-07-22 09:02:36 +00:00
# Simple detect c-ares
find_path(ARES_HEADER ares.h)
if (ARES_HEADER)
add_definitions("-DWITH_SRV")
set (LIBRARIES ${LIBRARIES} cares)
else (ARES_HEADER)
message(WARNING "c-ares library not found.")
endif (ARES_HEADER)
2014-05-07 22:27:00 +00:00
endif (${WITH_SRV} STREQUAL ON)
target_link_libraries(libmosquitto ${LIBRARIES})
set_target_properties(libmosquitto PROPERTIES
OUTPUT_NAME mosquitto
VERSION ${VERSION}
SOVERSION 1
)
install(TARGETS libmosquitto RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${LIBDIR})
install(FILES mosquitto.h DESTINATION ${INCLUDEDIR})
if (UNIX)
install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
endif (UNIX)