Skip to content
Tsukini edited this page Oct 17, 2026 · 8 revisions

Table of Contents

CMake

Once installed (Installing):

find_package(utils 4.2.0 REQUIRED)                      # minimal version
target_link_libraries(${TARGET} PRIVATE utils::utils)   # includes, static lib & OpenSSL

The library linked follows the CMAKE_BUILD_TYPE of your project:

Your build type Library Package needed (Linux) Package needed (Windows)
Debug libutils_debug.a libutils-db mingw64-libutils-db
Asan libutils_asan.a (build your project with -fsanitize=address too) libutils-as none (no AddressSanitizer with MinGW, use Debug)
anything else libutils.a (optimized) libutils-op (in libutils) mingw64-libutils-op (in mingw64-libutils)

A missing package stops the configuration with a message giving the package to install (same package names for RPM, DEB and Arch).

Note

Windows (MinGW-w64): the same CMake code works for both. Configure your project with a MinGW toolchain whose CMAKE_FIND_ROOT_PATH is the MinGW sysroot (-DCMAKE_TOOLCHAIN_FILE=: cmake/toolchain/mingw-w64.cmake of libutils, or /usr/share/mingw/toolchain-mingw64.cmake / mingw64-cmake on Fedora): find_package finds the mingw64-libutils* packages (Installing) or the install tree of a source build, and utils::utils also links ws2_32. Everything about Windows: Windows (usage).

Include

#define _Network        // only the needed sections (nothing defined = everything)
#include <utils/utils.hpp>

int main(void)
{
    std::cout << utils::version << std::endl; // "v4.2.0"
    return 0;
}

Pages

Page Content
Includes How to only include some parts of the libutils or everything...
Exception Want to add new custom exception ?
Warning How to enable/disable warning individually or by groups
Windows Cross compilation for Windows (MinGW-w64): toolchain, packages, your project, tests

Clone this wiki locally