Skip to content

Commit

Permalink
build both shared and static
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamet committed Dec 25, 2011
1 parent bce7fe0 commit fa2657f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
option(zrpc_build_tests "Build zrpc's tests." OFF)
option(zrpc_build_static "Build static library." OFF)

include(ExternalProject)
# Install GFlags
Expand Down
12 changes: 10 additions & 2 deletions src/zrpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ set(ZRPC_SOURCES clock.cc function_server.cc remote_response.cc
connection_manager.cc rpc_channel_impl.cc rpc.cc server.cc
reactor.cc zmq_utils.cc sync_event.cc event_manager.cc
${PROTO_SOURCES})
add_library(zrpc ${ZRPC_SOURCES})
target_link_libraries(zrpc ${ZeroMQ_LIBRARIES}
set(ZRPC_LIB_DEPS ${ZeroMQ_LIBRARIES}
${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} ${PROTOBUF_LIBRARY}
${Boost_THREAD_LIBRARIES})

if(zrpc_build_static)
add_library(zrpc_static STATIC ${ZRPC_SOURCES})
target_link_libraries(zrpc_static ${ZRPC_LIB_DEPS})
set_target_properties(zrpc_static PROPERTIES OUTPUT_NAME zrpc)
endif(zrpc_build_static)

add_library(zrpc SHARED ${ZRPC_SOURCES})
target_link_libraries(zrpc ${ZRPC_LIB_DEPS})

add_executable(zsendrpc zsendrpc.cc)
target_link_libraries(zsendrpc zrpc)

0 comments on commit fa2657f

Please sign in to comment.