1 | add_subdirectory(cpp)
|
2 |
|
3 | option(WITH_THREADING "Include client library threading support?" ON)
|
4 | if (${WITH_THREADING} STREQUAL ON)
|
5 | add_definitions("-DWITH_THREADING")
|
6 | if (WIN32)
|
7 | set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
|
8 | set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
|
9 | else (WIN32)
|
10 | set (PTHREAD_LIBRARIES pthread)
|
11 | set (PTHREAD_INCLUDE_DIR "")
|
12 | endif (WIN32)
|
13 | else (${WITH_THREADING} STREQUAL ON)
|
14 | set (PTHREAD_LIBRARIES "")
|
15 | set (PTHREAD_INCLUDE_DIR "")
|
16 | endif (${WITH_THREADING} STREQUAL ON)
|
17 |
|
18 | include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/lib
|
19 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}
|
20 | ${OPENSSL_INCLUDE_DIR} ${PTHREAD_INCLUDE_DIR})
|
21 | link_directories(${mosquitto_SOURCE_DIR}/lib)
|
22 |
|
23 | add_library(libmosquitto SHARED
|
24 | logging_mosq.c logging_mosq.h
|
25 | memory_mosq.c memory_mosq.h
|
26 | messages_mosq.c messages_mosq.h
|
27 | mosquitto.c mosquitto.h
|
28 | mosquitto_internal.h
|
29 | mqtt3_protocol.h
|
30 | net_mosq.c net_mosq.h
|
31 | read_handle.c read_handle.h
|
32 | read_handle_client.c
|
33 | read_handle_shared.c
|
34 | send_client_mosq.c
|
35 | send_mosq.c send_mosq.h
|
36 | srv_mosq.c
|
37 | thread_mosq.c
|
38 | time_mosq.c
|
39 | tls_mosq.c
|
40 | util_mosq.c util_mosq.h
|
41 | will_mosq.c will_mosq.h)
|
42 |
|
43 | set (LIBRARIES ${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES})
|
44 |
|
45 | if (UNIX AND NOT APPLE)
|
46 | set (LIBRARIES ${LIBRARIES} rt)
|
47 | endif (UNIX AND NOT APPLE)
|
48 |
|
49 | if (WIN32)
|
50 | set (LIBRARIES ${LIBRARIES} ws2_32)
|
51 | endif (WIN32)
|
52 |
|
53 | option(WITH_SRV "Include SRV lookup support?" ON)
|
54 | if (${WITH_SRV} STREQUAL ON)
|
55 | set (LIBRARIES ${LIBRARIES} cares)
|
56 | endif (${WITH_SRV} STREQUAL ON)
|
57 |
|
58 | target_link_libraries(libmosquitto ${LIBRARIES})
|
59 |
|
60 | set_target_properties(libmosquitto PROPERTIES
|
61 | OUTPUT_NAME mosquitto
|
62 | VERSION ${VERSION}
|
63 | SOVERSION 1
|
64 | )
|
65 |
|
66 | install(TARGETS libmosquitto RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${LIBDIR})
|
67 | install(FILES mosquitto.h DESTINATION ${INCLUDEDIR})
|
68 |
|
69 | if (UNIX)
|
70 | install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
|
71 | endif (UNIX)
|