Skip to content

Examples

Task-oriented recipes. Each page is self-contained, compiles as a single main.cpp, and progresses from trivial usage to more elaborate pipelines.

Simple

Intermediate

Elaborate

How to run the examples

Each recipe assumes the following layout:

example/
├── CMakeLists.txt
├── vcpkg.json
└── main.cpp

With the standard CMakeLists.txt:

cmake
cmake_minimum_required(VERSION 3.26)
project(example LANGUAGES CXX)

find_package(swaggercpp CONFIG REQUIRED)

add_executable(example main.cpp)
target_link_libraries(example PRIVATE swaggercpp::swaggercpp)
target_compile_features(example PRIVATE cxx_std_23)

And this vcpkg.json:

json
{
  "name": "example",
  "version": "0.1.0",
  "dependencies": [ "swaggercpp" ],
  "builtin-baseline": "<sha-from-vcpkg>"
}

Then build:

powershell
cmake --preset default
cmake --build out/build/default

See Installation for the full toolchain setup.

Released under the MIT License.