libowfat
This tree keeps the original GNUmakefile build unchanged and adds a standalone CMake build for projects that want to consume libowfat directly or as a CMake subdirectory.
CMake build
Out-of-tree builds are supported and recommended:
cmake -S . -B build
cmake --build build
The CMake build reads the library version from the first line of CHANGES.
For example, with the current CHANGES this produces version 0.35.
By default CMake builds the shared library. Static and shared builds can be selected independently:
cmake -S . -B build \
-DLIBOWFAT_BUILD_SHARED=ON \
-DLIBOWFAT_BUILD_STATIC=ON
The installed library basename can be prefixed without changing the headers or
CMake package name. The default prefix is empty, so the output is libowfat.
For a NetWare-flavoured name, pass nw and the output becomes libnwowfat:
cmake -S . -B build -DLIBOWFAT_LIBRARY_PREFIX=nw
Install
Installation uses CMake GNUInstallDirs, so the library directory follows the
target platform and install prefix (lib, lib64, etc.). Headers are installed
below include/libowfat.
cmake --install build --prefix /usr
Useful install options:
cmake -S . -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib64
Generated compatibility headers
The CMake build generates the same style of compatibility headers as the GNUmakefile build, but places them in the build tree instead of the source tree. Both the build-tree target and the installed package export include paths for:
<build>/generated<build>/generated/libowfat<prefix>/include<prefix>/include/libowfat
This lets normal includes such as <libowfat/buffer.h> work, and also keeps
internal or compatibility includes such as "haveip6.h", "havesendfile.h",
"iopause.h", "select.h", and "entities.h" available when the project is
used through add_subdirectory() or find_package(libowfat CONFIG REQUIRED).
Tests
The GNUmakefile all target builds the root t smoke-test program; CMake does
the same when BUILD_TESTING is enabled, and registers it with CTest:
ctest --test-dir build --output-on-failure
The UNITTEST sources used by the GNUmakefile check target can also be built
and registered with CTest:
cmake -S . -B build -DLIBOWFAT_BUILD_UNIT_TESTS=ON
cmake --build build
ctest --test-dir build --output-on-failure -L libowfat-unit
glibc compatibility
The CMake build uses the system C compiler and glibc-compatible feature checks
instead of dietlibc-specific assumptions. On Linux the configure checks use
_GNU_SOURCE so glibc extension declarations are visible; the library itself
still relies on the existing source-level feature defines where individual
files need them.