Download and Installation

Ninbot is a C26 library built with CMake >= 4.0 and C20 named modules.

Requirements

  • CMake >= 4.0

  • Ninja build system

  • One of the following compilers:

    • GCC >= 16

    • Clang >= 21

Building

Clone the repository and configure with the default preset:

git clone https://gitlab.com/ninbot/ninbot.git
cd ninbot
cmake --preset default
cmake --build build

The default preset builds a release library with GCC and Ninja. Other presets are: - default: The default build configuration for end users. - docs: Builds the documentation and example code. Requires Antora. - gcc: Debug build with the GNU GCC compiler. - clang: Debug build with the LLVM Clang compiler.

Installing

System-wide installation

Install to the default system prefix (usually /usr/local):

sudo cmake --install build

Local installation

Install to a custom prefix, for example ~/.local:

cmake --install build --prefix ~/.local

Using Ninbot in your project

After installation, add Ninbot to your CMakeLists.txt:

cmake_minimum_required(VERSION 4.0)
project(my_project LANGUAGES CXX)

find_package(ninbot REQUIRED)

add_executable(my_app main.c++)
target_link_libraries(my_app PRIVATE ninbot::ninbot)

When using a non-standard prefix, tell CMake where to find the library in your project when calling cmake:

cmake -B build -G Ninja -DCMAKE_PREFIX_PATH=$HOME/.local

Then import the module in your source code:

import ninbot;

Using without installation

You can use Ninbot directly from the source tree without installing it. After building with the default preset, point CMAKE_PREFIX_PATH to the Ninbot build directory:

cd ninbot
cmake --preset default
cmake --build build

cd /path/to/my_project
cmake -B build -G Ninja -DCMAKE_PREFIX_PATH=/path/to/ninbot/build
cmake --build build

Ninbot exports its targets from the build tree, so find_package(ninbot REQUIRED) works without cmake --install. Your project’s CMakeLists.txt is exactly the same as in the installed case.

Using as a CMake subproject

Alternatively, you can add Ninbot as a subdirectory of your project using add_subdirectory():

cmake_minimum_required(VERSION 4.0)
project(my_project LANGUAGES CXX)

add_subdirectory(ninbot)

add_executable(my_app main.c++)
target_link_libraries(my_app PRIVATE ninbot::ninbot)

This approach embeds the library build into your own and does not require a separate configure step.