docs: add cmake usage instructions

This commit is contained in:
Carlos Gomes Martinho 2020-05-08 02:45:52 +02:00
parent af21c2e26f
commit 52bd9d5bb8

View file

@ -208,7 +208,7 @@ The library has 2 sets of APIs for encoding and decoding:
Tested with <strong>clang-5.0</strong> and <strong>g++-6.4</strong>. Tested with <strong>clang-5.0</strong> and <strong>g++-6.4</strong>.
With issue#12, <strong>VS2017</strong> is also supported. With issue#12, <strong>VS2017</strong> is also supported.
## Installation ## Building the library
### using conan ### using conan
@ -232,6 +232,23 @@ cmake ..
cmake --build . -j cmake --build . -j
``` ```
## Consuming the library
this library is uses cmake as a build system.
```cmake
# you can use cmake's `find_package` after installation or `add_subdirectory` when vendoring this repository
find_package(cpp-jwt REQUIRED)
# or
add_subdirectory(third_party/cpp-jwt)
add_executable(main main.cpp)
target_link_libraries(main cpp-jwt::cpp-jwt)
```
you can also use this library as a conan package, its available in the [conan center](https://conan.io/center/cpp-jwt/1.2/?user=_&channel=_):
just add `cpp-jwt[>=1.2]` to your conanfile.txt
## Parameters ## Parameters
There are two sets of parameters which can be used for creating `jwt_object` and for decoding. There are two sets of parameters which can be used for creating `jwt_object` and for decoding.
All the parameters are basically a function which returns an instance of a type which are modelled after <code>ParameterConcept</code> (see <code>jwt::detail::meta::is_parameter_concept</code>). All the parameters are basically a function which returns an instance of a type which are modelled after <code>ParameterConcept</code> (see <code>jwt::detail::meta::is_parameter_concept</code>).