Commit 07b2b9c1 authored by Harris Hancock's avatar Harris Hancock

Update example CMake usage to best practices

parent 3a2f34c2
......@@ -9,9 +9,9 @@
# Example usage:
# find_package(CapnProto)
# capnp_generate_cpp(CAPNP_SRCS CAPNP_HDRS schema.capnp)
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# add_executable(foo main.cpp ${CAPNP_SRCS})
# target_link_libraries(foo CapnProto::capnp)
# target_link_libraries(foo PRIVATE CapnProto::capnp)
# target_include_directories(foo PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
#
# If you are using RPC features, use 'CapnProto::capnp-rpc' in the target_link_libraries() call.
#
......
......@@ -3,12 +3,12 @@
# Example usage:
# find_package(CapnProto)
# capnp_generate_cpp(CAPNP_SRCS CAPNP_HDRS schema.capnp)
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
# add_executable(foo main.cpp ${CAPNP_SRCS})
# target_link_libraries(foo CapnProto::capnp-rpc)
# target_link_libraries(foo PRIVATE CapnProto::capnp-rpc)
# target_include_directories(foo PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
#
# If you are using not using the RPC features you can use
# 'CapnProto::capnp' in target_link_libraries call
# If you are not using the RPC features you can use 'CapnProto::capnp' in the
# target_link_libraries call
#
# Configuration variables (optional):
# CAPNPC_OUTPUT_DIR
......
......@@ -23,7 +23,7 @@ find_package(CapnProto CONFIG REQUIRED)
capnp_generate_cpp(addressbookSources addressbookHeaders addressbook.capnp)
add_executable(addressbook addressbook.c++ ${addressbookSources})
target_link_libraries(addressbook CapnProto::capnp)
target_link_libraries(addressbook PRIVATE CapnProto::capnp)
target_include_directories(addressbook PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# Don't build the rpc sample if find_package() found an installation of Cap'n Proto lite.
......@@ -31,8 +31,8 @@ if(TARGET CapnProto::capnp-rpc)
capnp_generate_cpp(calculatorSources calculatorHeaders calculator.capnp)
add_executable(calculator-client calculator-client.c++ ${calculatorSources})
add_executable(calculator-server calculator-server.c++ ${calculatorSources})
target_link_libraries(calculator-client CapnProto::capnp-rpc)
target_link_libraries(calculator-server CapnProto::capnp-rpc)
target_link_libraries(calculator-client PRIVATE CapnProto::capnp-rpc)
target_link_libraries(calculator-server PRIVATE CapnProto::capnp-rpc)
target_include_directories(calculator-client PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(calculator-server PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment