Skip to content

kaycxx/library-template

Repository files navigation

library-template

C++ library template.

GitHub | API Documentation

Requirements

  • C++23 compiler and standard library
  • Exception support
  • Run-time type information (RTTI)

Usage

#include <kaycxx/library-template.hpp>

int main() {
    return kaycxx::library_template::sum(1, 2);
}

CMake users consume the installed package with:

find_package(kaycxx-library-template 1.0.0 CONFIG REQUIRED)
target_link_libraries(my-target PRIVATE kaycxx::library-template)

Non-CMake users can use pkg-config:

c++ $(pkg-config --cflags kaycxx-library-template) -c main.cpp
c++ main.o $(pkg-config --libs kaycxx-library-template)

Build From Source

cmake -B build
cmake --build build

A shared library is built by default. For a static build:

cmake -B build -D BUILD_SHARED_LIBS=OFF
cmake --build build

Install

cmake --install build --prefix /tmp/root

If no prefix is specified, CMake installs to /usr/local by default on Unix systems.

Development

Run all tests:

cmake --build build --target test

Generate API documentation with Doxygen:

cmake --build build --target apidoc

The generated HTML documentation is written to build/apidoc/html/index.html.