@@ -65,36 +65,48 @@ target_link_libraries(jsonrpccommon ${JSONCPP_LIBRARIES})
65
65
set_target_properties (jsonrpccommon PROPERTIES OUTPUT_NAME jsonrpccpp-common )
66
66
67
67
# 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 ()
71
73
72
74
# setup shared client library
73
75
add_library (jsonrpcclient SHARED ${jsonrpc_source_client} ${jsonrpc_header} ${jsonrpc_header_client} ${client_connector_source} )
74
- add_dependencies (jsonrpcclient jsonrpccommonStatic )
76
+ add_dependencies (jsonrpcclient jsonrpccommon )
75
77
target_link_libraries (jsonrpcclient jsonrpccommon ${client_connector_libs} )
76
78
set_target_properties (jsonrpcclient PROPERTIES OUTPUT_NAME jsonrpccpp-client )
77
79
78
80
# 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 ()
82
86
83
87
# setup shared server library
84
88
add_library (jsonrpcserver SHARED ${jsonrpc_source_server} ${jsonrpc_header} ${jsonrpc_header_server} ${server_connector_source} )
85
- add_dependencies (jsonrpcserver jsonrpccommonStatic )
89
+ add_dependencies (jsonrpcserver jsonrpccommon )
86
90
target_link_libraries (jsonrpcserver jsonrpccommon ${server_connector_libs} )
87
91
set_target_properties (jsonrpcserver PROPERTIES OUTPUT_NAME jsonrpccpp-server )
88
92
89
93
# 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 ()
93
105
94
106
# setup version
95
107
set (VERSION_STRING ${MAJOR_VERSION} .${MINOR_VERSION}.${PATCH_VERSION} )
96
108
set_target_properties (
97
- jsonrpccommon jsonrpccommonStatic jsonrpcclient jsonrpcclientStatic jsonrpcserver jsonrpcserverStatic
109
+ ${ALL_LIBS}
98
110
PROPERTIES VERSION "${VERSION_STRING} " SOVERSION "${SO_VERSION} "
99
111
)
100
112
@@ -114,9 +126,9 @@ if (WIN32)
114
126
install (DIRECTORY ${CMAKE_SOURCE_DIR} /win32-deps/include DESTINATION . )
115
127
endif ()
116
128
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}
120
132
RUNTIME DESTINATION bin
121
133
)
122
134
0 commit comments