@@ -65,36 +65,48 @@ target_link_libraries(jsonrpccommon ${JSONCPP_LIBRARIES})
6565set_target_properties (jsonrpccommon PROPERTIES OUTPUT_NAME jsonrpccpp-common)
6666
6767# setup static common library
68- add_library (jsonrpccommonStatic STATIC ${jsonrpc_source_common} ${jsonrpc_header} ${jsonrpc_helper_source_common} )
69- target_link_libraries (jsonrpccommonStatic ${JSONCPP_LIBRARIES} )
70- set_target_properties (jsonrpccommonStatic PROPERTIES OUTPUT_NAME jsonrpccpp-common)
68+ if (BUILD_STATIC_LIBS)
69+ add_library (jsonrpccommonStatic STATIC ${jsonrpc_source_common} ${jsonrpc_header} ${jsonrpc_helper_source_common} )
70+ target_link_libraries (jsonrpccommonStatic ${JSONCPP_LIBRARIES} )
71+ set_target_properties (jsonrpccommonStatic PROPERTIES OUTPUT_NAME jsonrpccpp-common)
72+ endif ()
7173
7274# setup shared client library
7375add_library (jsonrpcclient SHARED ${jsonrpc_source_client} ${jsonrpc_header} ${jsonrpc_header_client} ${client_connector_source} )
74- add_dependencies (jsonrpcclient jsonrpccommonStatic )
76+ add_dependencies (jsonrpcclient jsonrpccommon )
7577target_link_libraries (jsonrpcclient jsonrpccommon ${client_connector_libs} )
7678set_target_properties (jsonrpcclient PROPERTIES OUTPUT_NAME jsonrpccpp-client)
7779
7880# setup static client library
79- add_library (jsonrpcclientStatic STATIC ${jsonrpc_source_client} ${jsonrpc_header} ${jsonrpc_header_client} ${client_connector_source} )
80- target_link_libraries (jsonrpcclientStatic jsonrpccommonStatic ${client_connector_libs} )
81- set_target_properties (jsonrpcclientStatic PROPERTIES OUTPUT_NAME jsonrpccpp-client)
81+ if (BUILD_STATIC_LIBS)
82+ add_library (jsonrpcclientStatic STATIC ${jsonrpc_source_client} ${jsonrpc_header} ${jsonrpc_header_client} ${client_connector_source} )
83+ target_link_libraries (jsonrpcclientStatic jsonrpccommonStatic ${client_connector_libs} )
84+ set_target_properties (jsonrpcclientStatic PROPERTIES OUTPUT_NAME jsonrpccpp-client)
85+ endif ()
8286
8387# setup shared server library
8488add_library (jsonrpcserver SHARED ${jsonrpc_source_server} ${jsonrpc_header} ${jsonrpc_header_server} ${server_connector_source} )
85- add_dependencies (jsonrpcserver jsonrpccommonStatic )
89+ add_dependencies (jsonrpcserver jsonrpccommon )
8690target_link_libraries (jsonrpcserver jsonrpccommon ${server_connector_libs} )
8791set_target_properties (jsonrpcserver PROPERTIES OUTPUT_NAME jsonrpccpp-server)
8892
8993# setup static server library
90- add_library (jsonrpcserverStatic STATIC ${jsonrpc_source_server} ${jsonrpc_header} ${jsonrpc_header_server} ${server_connector_source} )
91- target_link_libraries (jsonrpcserverStatic jsonrpccommonStatic ${server_connector_libs} )
92- set_target_properties (jsonrpcserverStatic PROPERTIES OUTPUT_NAME jsonrpccpp-server)
94+ if (BUILD_STATIC_LIBS)
95+ add_library (jsonrpcserverStatic STATIC ${jsonrpc_source_server} ${jsonrpc_header} ${jsonrpc_header_server} ${server_connector_source} )
96+ target_link_libraries (jsonrpcserverStatic jsonrpccommonStatic ${server_connector_libs} )
97+ set_target_properties (jsonrpcserverStatic PROPERTIES OUTPUT_NAME jsonrpccpp-server)
98+ endif ()
99+
100+ set (ALL_LIBS jsonrpccommon jsonrpcclient jsonrpcserver)
101+
102+ if (BUILD_STATIC_LIBS)
103+ list (APPEND ALL_LIBS jsonrpccommonStatic jsonrpcclientStatic jsonrpcserverStatic)
104+ endif ()
93105
94106# setup version
95107set (VERSION_STRING ${MAJOR_VERSION} .${MINOR_VERSION} .${PATCH_VERSION} )
96108set_target_properties (
97- jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic
109+ ${ALL_LIBS}
98110 PROPERTIES VERSION "${VERSION_STRING} " SOVERSION "${SO_VERSION} "
99111)
100112
@@ -114,9 +126,9 @@ if (WIN32)
114126 install (DIRECTORY ${CMAKE_SOURCE_DIR} /win32 -deps/include DESTINATION .)
115127endif ()
116128
117- install (TARGETS jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic
118- LIBRARY DESTINATION lib
119- ARCHIVE DESTINATION lib
129+ install (TARGETS ${ALL_LIBS}
130+ LIBRARY DESTINATION lib${LIB_SUFFIX}
131+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
120132 RUNTIME DESTINATION bin
121133)
122134
0 commit comments