Use as a Bazel Dependency
To use libcbor in your Baze project, first add the following section to your project's WORKSPACE
file. Note the location of the third_party/libcbor.BUILD
file - you may use a different location if you wish, but you the file must be make available to WORKSPACE
.
WORKSPACE
Note, this imports version 0.8.0
- you may need to update the version and the sha256 hash.
third_party/libcbor.BUILD
Bazel will unzip the libcbor zip file, then copy this file in as BUILD
. Bazel will then use this file to compile libcbor. Cmake is used in two passes: to create the Makefiles, and then to invoke Make to build the libcbor.a
static library. libcbor.a
and the .h
files are then made available for other packages to use.
third_party/BUILD
The libcbor.BUILD
file must be make available to the top-level WORKSPACE
file:
Your BUILD File
Add libcbor dependency to your package's BUILD
file like so:
Your C File
Now you may simply include cbor.h
: