Use
cmake --install build --prefix <dir> # or: make install PREFIX=<dir>
then, in another CMake project,
find_package(ADS REQUIRED)
target_link_libraries(<target> PRIVATE ADS::ADS)
or, with pkg-config, pkg-config --cflags ads. The packages of vcpkg
(ads), conda-forge (cpp-ads), Homebrew, Debian and Ubuntu
(libads-dev), Conan, Spack, Nix, the AUR, MSYS2 and xmake install the same
files, from the recipes of packaging. Without
installing anything, a CMake project can also take ADS at configure time,
with FetchContent (CMake 3.24 or later),
include(FetchContent)
FetchContent_Declare(ADS
URL https://github.com/dmeoli/ADS/releases/download/v0.1.0/ADS-0.1.0.tar.gz
FIND_PACKAGE_ARGS 0.1) # an installed ADS, if there is one
FetchContent_MakeAvailable(ADS)
target_link_libraries(<target> PRIVATE ADS::ADS)
or with CPM.cmake,
CPMAddPackage("gh:dmeoli/ADS@0.1.0")
target_link_libraries(<target> PRIVATE ADS::ADS)
and as a subproject ADS builds neither its tests nor its benchmarks. With
Bazel, bazel_dep(name = "ads", version = "0.1.0") in MODULE.bazel and
deps = ["@ads"], from the Bazel Central Registry; with Meson, meson wrap install ads and dependency('ads'), from WrapDB; in both, the targets
compile in C++20.
BigInteger (and through it Rational) can run on the backend of
GMP, which takes the products, the quotients, the
conversions and the greatest common divisor in the ranges of lengths where
GMP is the faster, and leaves the others to the code of ADS: with CMake,
-DADS_WITH_GMP=ON (off by default, and an error at configure time if GMP
is not found) defines ADS_WITH_GMP on ADS::ADS and links GMP, also for
the projects that find the installed ADS; without CMake, -DADS_WITH_GMP
and -lgmp, as make test ADS_WITH_GMP=1 [GMP=<prefix>] does. GMP is
under the LGPL v3 (or the GPL v2), compatible with the LGPL v3 of ADS;
without the macro nothing of GMP is included.
#include "ADS/sequence/List.h"
ADS::List< int > L{ 3 , 1 , 2 };
for( auto p = L.head() ; ! L.finished( p ) ; p = L.next( p ) )
std::cout << L.read( p ); // the positions of the book
std::ranges::reverse( L ); // the algorithms of std
for( int x : L ) std::cout << x;