Skip to content

README: document the plain CMake install route #413

Description

@Bronek

Gap

README.md ## Using the library → As a dependency opens with

find_package(libfn CONFIG REQUIRED)
target_link_libraries(main PRIVATE libfn::fn)

but the document never states the most direct way to make that line resolvable without a registry: installing the package from a source checkout. The packaging sentence lists conan, vcpkg, Nix, Bazel, and "plain CMake FetchContent or add_subdirectory" — the latter two are the sub-project route, not the install route. The install tree already exports a complete, relocatable config-mode package (libfnConfig.cmake, libfnConfigVersion.cmake, libfnTargets), so this is purely a documentation gap: the capability exists and is exercised by the registries; only the direct consumer is left uninformed.

Proposed wording

Insert in ### As a dependency, immediately after the packaging-routes sentence (currently README.md:175) and before the compile-options paragraph:

The package can also be installed straight from a source checkout or release tarball:

cmake -B .build -DLIBFN_TESTS=OFF
sudo cmake --install .build    # `sudo` required because install prefix is default `/usr/local`
# cmake --install .build --prefix ~/.local # install in user directory

after which find_package(libfn CONFIG REQUIRED) works as above (for a non-default prefix, point CMAKE_PREFIX_PATH at it).

Details the wording deliberately encodes:

  • -DLIBFN_TESTS=OFF: tests default to ON even when libfn is the top-level project, so a bare configure fetches Catch2 and a bare install builds the whole suite first. With tests off, a header-only install compiles nothing.
  • The config package is generated via configure_package_config_file, so it is relocatable — cmake --install .build --prefix <path> is safe without reconfiguring.
  • .build follows the repository's own build-tree convention (.build* is gitignored, as is build/), so the documented commands leave a cloned checkout clean.
  • Placement before the compile-options paragraph is deliberate: the installed package exports the same INTERFACE compile options as every other CMake route, so the existing "every packaging route above except Bazel" sentence covers this route as-is once it is listed above it.

Assisted-by: Claude:claude-fable-5

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions