Examples

The examples subfolder contains C++ examples which shall show the usage of the C++ library.

project
├── ...
├── examples
│   ├── CMakeLists.txt
│   ├── hello_world.cpp
├── ...

Build System

There is a meta target called examples which bundles the build process of all cpp files in the folder examples in one target. Assuming your cmake-build directory is called bld the following will build all examples.

$ cd bld
$ make examples

Adding New Examples

To add new examples just add a new cpp file to the example folder and update the CMakeLists.txt. Assuming we named the new cpp file my_new_example.cpp, the relevant part in the CMakeLists.txt shall look like this:

# all examples
set(CPP_EXAMPLE_FILES
   hello_world.cpp
   my_new_example.cpp
)

After changing the CMakeLists.txt cmake needs to be rerun to configure the build again. After that make examples will build all examples including the freshly added examples.

$ cd bld
$ cmake .
$ make examples