New project setup#

This guide walks through creating a LIBRA project from scratch. By the end you will have a buildable project with tests, a working preset hierarchy, and a project-local.cmake that registers your targets.

1. Create the project skeleton#

mkdir my_project && cd my_project
git init

mkdir -p src include tests cmake docs

Create CMakeLists.txt and cmake/project-local.cmake according to the Integrating LIBRA into your project and project-local.cmake respectively. See also project-local.cmake: How To Hook Into LIBRA for the full project-local.cmake API.

Optionally, create CMakePresets.json/CMakeUserPresets.json. See CMakePresets.json for details.

2. Add a source file#

// src/main.cpp
#include <cstdio>
int main() { std::puts("hello from LIBRA"); }

3. Build#

clibra build --preset debug

On first run, clibra detects the missing build directory and runs configure automatically before building.

cmake --preset debug
cmake --build --preset debug -j$(nproc)

4. Verify with doctor / help-targets#

clibra doctor     # check tool availability
clibra info       # show targets and feature flag state
cmake --build --preset debug --target help-targets

5. Add tests#

Create a test file following the naming convention:

// tests/main-utest.cpp
#include <cassert>
int main() { assert(1 + 1 == 2); }

Then build and run:

clibra test --preset debug
cmake --build --preset debug --target all-tests
ctest --preset debug --output-on-failure

Next steps#