Skip to content

Commit c3f7e61

Browse files
author
Peter Spiess-Knafl
committed
renaming libraries + bugfixes
1 parent 5e78588 commit c3f7e61

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

src/jsonrpccpp/CMakeLists.txt

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
find_package(JSONCPP REQUIRED)
2+
find_package(Threads REQUIRED)
23

34
file(GLOB jsonrpc_source_common common/*.c*)
45
file(GLOB jsonrpc_source_client client/*.c*)
@@ -41,54 +42,63 @@ IF(HTTP_SERVER_MONGOOSE)
4142
list(APPEND server_connector_source "server/connectors/mongoose.c")
4243
list(APPEND server_connector_header "server/connectors/httpserver.h")
4344
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})
4546
ENDIF()
4647

47-
IF (SOCKET_CLIENT)
48+
IF(SOCKET_CLIENT)
4849
find_package(Threads REQUIRED)
4950
list(APPEND client_connector_header "client/connectors/socketclient.h")
5051
list(APPEND client_connector_source "client/connectors/socketclient.cpp")
5152
ENDIF()
5253

53-
IF (SOCKET_SERVER)
54+
IF(SOCKET_SERVER)
5455
find_package(Threads REQUIRED)
5556
list(APPEND server_connector_header "server/connectors/socketserver.h")
5657
list(APPEND server_connector_source "server/connectors/socketserver.cpp")
58+
list(APPEND server_connector_libs ${CMAKE_THREAD_LIBS_INIT})
59+
5760
ENDIF()
5861

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")
6366
ENDIF()
6467

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})
6770
target_link_libraries(jsonrpccommon ${JSONCPP_LIBRARIES})
6871
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+
7075

7176
add_library(jsonrpcclient SHARED ${jsonrpc_source_client} ${client_connector_source})
7277
add_library(jsonrpcclientStatic STATIC ${jsonrpc_source_client} ${client_connector_source})
7378
target_link_libraries(jsonrpcclient jsonrpccommon ${client_connector_libs})
7479
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+
7683

7784
add_library(jsonrpcserver SHARED ${jsonrpc_source_server} ${server_connector_source})
7885
add_library(jsonrpcserverStatic STATIC ${jsonrpc_source_server} ${server_connector_source})
7986
target_link_libraries(jsonrpcserver jsonrpccommon ${server_connector_libs})
8087
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+
8291

8392
set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
8493
set_target_properties(jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic PROPERTIES VERSION "${VERSION_STRING}" SOVERSION "${MAJOR_VERSION}.${MINOR_VERSION}")
8594

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)
92102

93103
install(TARGETS jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic
94104
LIBRARY DESTINATION lib

0 commit comments

Comments
 (0)