Skip to content

Add a CMake build alongside autotools - #606

Open
matejk wants to merge 4 commits into
LinearTapeFileSystem:release/v2.4.9.0from
matejk:feature/cmake-build
Open

Add a CMake build alongside autotools#606
matejk wants to merge 4 commits into
LinearTapeFileSystem:release/v2.4.9.0from
matejk:feature/cmake-build

Conversation

@matejk

@matejk matejk commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a CMake build (>= 3.18) that coexists with the autotools build, plus CI updates. Rebased onto the v2.4.8.4 release on main; 4 commits:

  • VERSION file: the package version moves from AC_INIT to a top-level VERSION file read by both build systems, so there is a single source of truth. It tracks the release version (2.4.8.4), and the autotools PACKAGE_VERSION string is unchanged.
  • Reusable message-compile script: messages/make_message_src.sh accepts optional source/output directories and honors $GENRB/$PKGDATA, so an out-of-source build can call it; the one-argument form keeps the historical behavior and messages/Makefile.am is unchanged.
  • CI: a new workflow configures, builds, and runs ctest. Version updates for the existing workflows are in ci: update deprecated GitHub Actions versions #622.
  • The CMake build itself.
  • C11: a dedicated commit raises the CMake build to the C11 standard (gnu11).

Scope

Linux is fully wired: libltfs, the ltfs/mkltfs/ltfsck executables, the sg/file/itdtimg tape backends, both I/O schedulers, both key managers. macOS additionally builds the iokit tape backend. The FreeBSD/NetBSD backends are skipped with a notice and remain autotools-only. The build targets libfuse 2, matching autotools; the FUSE 3 selection follows as a small extension once #603 merges.

The CMake build compiles as C11 (gnu11, since LTFS uses _GNU_SOURCE/asprintf); a commented-out C17 line is provided for when the minimum supported toolchain is GCC 8+/Clang 7+.

Notable differences from the autotools implementation:

  • ICU is found through CMake's ICU module instead of the icu-config tool that ICU removed in 2018 (ICU6x is set automatically for ICU >= 60); libxml2 uses find_package(LibXml2); fuse/uuid/net-snmp use pkg-config imported targets.
  • The per-backend source symlinks and the CRC_OPTIMIZE rule are replaced by direct source paths and one SSE4.2-flagged OBJECT library.
  • Plugins are MODULE libraries named exactly as ltfs.conf expects (libtape-sg.so etc.), installed to <libdir>/ltfs.
  • ctest registers tests/t/*.sh by glob via the shared harness, so the build works with or without the integration test suite (Add an integration test suite using the file tape backend #611) and picks up its tests automatically.

Verification

Ubuntu VM: the CMake build and all 14 integration tests pass via ctest (with #611 merged alongside); the install tree matches autotools (bin, lib, plugins, etc/ltfs.conf{,.local}, pkgconfig, man, headers); ltfs --version reports the identical string; the autotools build and make check stay green. macOS 26 (arm64, macFUSE 5.2 SDK): the CMake build produces libltfs, the executables, and all plugins including libtape-iokit.so, as C11.

Fixes #521.

@vandelvan vandelvan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @matejk ! Thanks for contributing, Just a small comment

Comment thread .github/workflows/cmake.yml Outdated
@matejk

matejk commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Done, cmake.yml now uses actions/checkout@v6. The version updates for the existing workflows moved to a separate PR, #622.

@matejk
matejk requested a review from vandelvan July 3, 2026 22:48
@vandelvan
vandelvan changed the base branch from main to release/v2.4.9.0 July 10, 2026 20:26

@vandelvan vandelvan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you

matejk added 4 commits August 17, 2026 22:07
Single source of truth for the autotools and CMake builds.
…stem

Honor $GENRB/$PKGDATA and accept source and output directories; the
one-argument form is unchanged.
CMake >= 3.18, libfuse 2 like autotools. ICU via CMake's ICU module instead
of the removed icu-config; plugins are MODULE libraries named as ltfs.conf
expects; ctest registers tests/t/*.sh by glob.
gnu11: the sources use GNU extensions.
@matejk
matejk force-pushed the feature/cmake-build branch 2 times, most recently from b24c452 to 91f1ced Compare August 17, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cmake support

2 participants