view INSTALL.md @ 35:44f1392dd105 default tip @

make: ditch GNU make
author David Demelier <markand@malikania.fr>
date Tue, 07 Feb 2023 22:11:22 +0100
parents 5cbb723ad2a9
children
line wrap: on
line source

libbuf INSTALL
==============

Installation instructions.

Requirements
------------

- C99 compiler,
- POSIX make, only required to build,
- POSIX user land (ar, cc, cp, mkdir, rm), to install and test.

Embed
-----

Copy buf.h and buf.c to your project.

Installation
------------

The module is small enough to be incorporated verbatim into your project, but it
still possible to install it system wide.

### Using CMake

Using [CMake][cmake] you get proper CMake package configuration files, shared
libraries and `pkg-config` files.

	$ cmake -S . -B build -DBUILD_SHARED_LIBS=On
	$ cmake --build build
	# cmake --build build --target install

Turn `BUILD_SHARED_LIBS` to *Off* if you don't want shared libraries.

Then, you can import `buf` and use on of the imported targets:

- `buf::libbuf`: shared if available, static otherwise,
- `buf::libbuf-shared`: shared version,
- `buf::libbuf-static`: static version.

The test suite is available using:

	$ ctest --test-dir build

Example:

	cmake_minimum_required(VERSION 3.20)
	project(example)
	find_package(buf REQUIRED)
	add_executable(example example.c)
	target_link_libraries(example buf::libbuf)