|
1 | 1 | find_package(JSONCPP REQUIRED) |
| 2 | +find_package(Threads REQUIRED) |
2 | 3 |
|
3 | 4 | file(GLOB jsonrpc_source_common common/*.c*) |
4 | 5 | file(GLOB jsonrpc_source_client client/*.c*) |
@@ -41,54 +42,63 @@ IF(HTTP_SERVER_MONGOOSE) |
41 | 42 | list(APPEND server_connector_source "server/connectors/mongoose.c") |
42 | 43 | list(APPEND server_connector_header "server/connectors/httpserver.h") |
43 | 44 | list(APPEND server_connector_source "server/connectors/httpserver.cpp") |
44 | | - list(APPEND server_connector_libs ${CMAKE_DL_LIBS}) |
| 45 | + list(APPEND server_connector_libs ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) |
45 | 46 | ENDIF() |
46 | 47 |
|
47 | | -IF (SOCKET_CLIENT) |
| 48 | +IF(SOCKET_CLIENT) |
48 | 49 | find_package(Threads REQUIRED) |
49 | 50 | list(APPEND client_connector_header "client/connectors/socketclient.h") |
50 | 51 | list(APPEND client_connector_source "client/connectors/socketclient.cpp") |
51 | 52 | ENDIF() |
52 | 53 |
|
53 | | -IF (SOCKET_SERVER) |
| 54 | +IF(SOCKET_SERVER) |
54 | 55 | find_package(Threads REQUIRED) |
55 | 56 | list(APPEND server_connector_header "server/connectors/socketserver.h") |
56 | 57 | list(APPEND server_connector_source "server/connectors/socketserver.cpp") |
| 58 | + list(APPEND server_connector_libs ${CMAKE_THREAD_LIBS_INIT}) |
| 59 | + |
57 | 60 | ENDIF() |
58 | 61 |
|
59 | | -IF (SOCKET_CLIENT OR SOCKET_SERVER) |
60 | | - list(APPEND jsonrpc_header_common "common/helper/socket.h") |
61 | | - list(APPEND jsonrpc_header_common "common/helper/threads.h") |
62 | | - list(APPEND jsonrpc_source_common "common/helper/threads.cpp") |
| 62 | +IF(SOCKET_CLIENT OR SOCKET_SERVER) |
| 63 | + list(APPEND jsonrpc_helper_header_common "common/helper/socket.h") |
| 64 | + list(APPEND jsonrpc_helper_header_common "common/helper/threads.h") |
| 65 | + list(APPEND jsonrpc_helper_source_common "common/helper/threads.cpp") |
63 | 66 | ENDIF() |
64 | 67 |
|
65 | | -add_library(jsonrpccommon SHARED ${jsonrpc_source_common}) |
66 | | -add_library(jsonrpccommonStatic STATIC ${jsonrpc_source_common}) |
| 68 | +add_library(jsonrpccommon SHARED ${jsonrpc_source_common} ${jsonrpc_helper_source_common}) |
| 69 | +add_library(jsonrpccommonStatic STATIC ${jsonrpc_source_common} ${jsonrpc_helper_source_common}) |
67 | 70 | target_link_libraries(jsonrpccommon ${JSONCPP_LIBRARIES}) |
68 | 71 | target_link_libraries(jsonrpccommonStatic ${JSONCPP_LIBRARIES}) |
69 | | -set_target_properties(jsonrpccommonStatic PROPERTIES OUTPUT_NAME jsonrpccppcommon) |
| 72 | +set_target_properties(jsonrpccommonStatic PROPERTIES OUTPUT_NAME jsonrpccpp-common) |
| 73 | +set_target_properties(jsonrpccommon PROPERTIES OUTPUT_NAME jsonrpccpp-common) |
| 74 | + |
70 | 75 |
|
71 | 76 | add_library(jsonrpcclient SHARED ${jsonrpc_source_client} ${client_connector_source}) |
72 | 77 | add_library(jsonrpcclientStatic STATIC ${jsonrpc_source_client} ${client_connector_source}) |
73 | 78 | target_link_libraries(jsonrpcclient jsonrpccommon ${client_connector_libs}) |
74 | 79 | target_link_libraries(jsonrpcclientStatic jsonrpccommonStatic ${client_connector_libs}) |
75 | | -set_target_properties(jsonrpcclientStatic PROPERTIES OUTPUT_NAME jsonrpccppclient) |
| 80 | +set_target_properties(jsonrpcclientStatic PROPERTIES OUTPUT_NAME jsonrpccpp-client) |
| 81 | +set_target_properties(jsonrpcclient PROPERTIES OUTPUT_NAME jsonrpccpp-client) |
| 82 | + |
76 | 83 |
|
77 | 84 | add_library(jsonrpcserver SHARED ${jsonrpc_source_server} ${server_connector_source}) |
78 | 85 | add_library(jsonrpcserverStatic STATIC ${jsonrpc_source_server} ${server_connector_source}) |
79 | 86 | target_link_libraries(jsonrpcserver jsonrpccommon ${server_connector_libs}) |
80 | 87 | target_link_libraries(jsonrpcserverStatic jsonrpccommonStatic ${server_connector_libs}) |
81 | | -set_target_properties(jsonrpcserverStatic PROPERTIES OUTPUT_NAME jsonrpccppserver) |
| 88 | +set_target_properties(jsonrpcserverStatic PROPERTIES OUTPUT_NAME jsonrpccpp-server) |
| 89 | +set_target_properties(jsonrpcserver PROPERTIES OUTPUT_NAME jsonrpccpp-server) |
| 90 | + |
82 | 91 |
|
83 | 92 | set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) |
84 | 93 | set_target_properties(jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic PROPERTIES VERSION "${VERSION_STRING}" SOVERSION "${MAJOR_VERSION}.${MINOR_VERSION}") |
85 | 94 |
|
86 | | -install(FILES ${jsonrpc_header} DESTINATION include/jsonrpccpp) |
87 | | -install(FILES ${jsonrpc_header_common} DESTINATION include/jsonrpccpp/common) |
88 | | -install(FILES ${jsonrpc_header_client} DESTINATION include/jsonrpccpp/client) |
89 | | -install(FILES ${jsonrpc_header_server} DESTINATION include/jsonrpccpp/server) |
90 | | -install(FILES ${client_connector_header} DESTINATION include/jsonrpccpp/client/connectors) |
91 | | -install(FILES ${server_connector_header} DESTINATION include/jsonrpccpp/server/connectors) |
| 95 | +install(FILES ${jsonrpc_header} DESTINATION include/jsonrpccpp) |
| 96 | +install(FILES ${jsonrpc_header_common} DESTINATION include/jsonrpccpp/common) |
| 97 | +install(FILES ${jsonrpc_helper_header_common} DESTINATION include/jsonrpccpp/common/helper) |
| 98 | +install(FILES ${jsonrpc_header_client} DESTINATION include/jsonrpccpp/client) |
| 99 | +install(FILES ${jsonrpc_header_server} DESTINATION include/jsonrpccpp/server) |
| 100 | +install(FILES ${client_connector_header} DESTINATION include/jsonrpccpp/client/connectors) |
| 101 | +install(FILES ${server_connector_header} DESTINATION include/jsonrpccpp/server/connectors) |
92 | 102 |
|
93 | 103 | install(TARGETS jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic |
94 | 104 | LIBRARY DESTINATION lib |
|
0 commit comments