Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
e70cb0e3
Commit
e70cb0e3
authored
Feb 11, 2017
by
Harris Hancock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write a minimal CMakeLists.txt for c++/samples
parent
cd9fb393
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
CMakeLists.txt
c++/samples/CMakeLists.txt
+53
-0
No files found.
c++/samples/CMakeLists.txt
0 → 100644
View file @
e70cb0e3
# A Cap'n Proto sample project.
#
# To build (non-MSVC):
# 1. Install Cap'n Proto somewhere ($PREFIX below):
#
# mkdir capnproto/build
# cd capnproto/build
# cmake ../c++ -DCMAKE_INSTALL_PREFIX=$PREFIX
# cmake --build . --target install
# export PATH=$PREFIX/bin:$PATH
#
# 2. Ensure Cap'n Proto's executables are on the PATH, then build the sample project:
#
# export PATH=$PREFIX/bin:$PATH
# mkdir ../build-samples
# cd ../build-samples
# cmake ../c++/samples
# cmake --build .
#
# Caveat for MSVC:
#
# MSVC cannot yet build the Cap'n Proto executables, so there won't be any `$PREFIX/bin` directory
# to put on the PATH. To work around this, you can use CMAKE_PREFIX_PATH or CMAKE_MODULE_PATH to
# find the installed MSVC-built Cap'n Proto package, and set CAPNP_EXECUTABLE and
# CAPNPC_CXX_EXECUTABLE to the MinGW-built executables manually.
#
# Here's an example step 2, assuming a MinGW-built Cap'n Proto is installed at $PREFIX_MINGW and
# an MSVC-built Cap'n Proto is installed at $PREFIX_MSVC:
#
# mkdir ../build-samples
# cd ../build-samples
# cmake ../c++/samples -DCMAKE_PREFIX_PATH=$PREFIX_MSVC \
# -DCAPNP_EXECUTABLE=$PREFIX_MINGW/bin/capnp.exe \
# -DCAPNPC_CXX_EXECUTABLE=$PREFIX_MINGW/bin/capnpc-c++.exe
# cmake --build .
project
(
"Cap'n Proto Samples"
CXX
)
cmake_minimum_required
(
VERSION 3.0
)
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_include_directories
(
addressbook PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
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_include_directories
(
calculator-client PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
target_include_directories
(
calculator-server PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment