Skip to main content

C++

C++ bindings are WIP

not all features are usable

Same as in C version library can be installed system wide or included directly in a cmake project.

Include in a project

Library can be also directly included as in cmake a project.
In an existing project either clone it

git clone https://github.com/Imn0/timber-cpp.git libs/timber

or add as a submodule

git submodule add https://github.com/Imn0/timber-cpp.git libs/timber

Example CMakeLists.txt to link with timber-cpp

add_subdirectory(libs/timber)
target_link_libraries(${PROJECT_NAME} timber-cpp)
note

Manual setting of C++23 standard might be required

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Header only mode

As the library is just a single header file it can be included directly in a project

wget https://raw.githubusercontent.com/Imn0/timber-cpp/refs/heads/master/include/tmb/tmb.hpp

However for it to work the C version has to be in a include path.

warning

C++ wrapper requires full version of the C library.

System install

  1. Clone the repository

    git clone --recurse-submodules https://github.com/Imn0/timber-cpp.git
    cd timber-cpp
  2. Setup cmake

    mkdir build
    cd build
    cmake ..

    to change the install prefix

    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/$USER/opt/
  3. Compile and install

    cmake --build . --target install

    then link as normal