This commit adds a snapcraft.yaml file to allow lz4
to be distributed as a snap (see https://snapcraft.io/
for more info on snaps).
Building the Snap
-----------------
To build the snap simply install snapcraft and build the
snap e.g. on Ubuntu by doing:
$ sudo apt install snapcraft
$ cd contrib; snapcraft
This will build a snap that can be published [1] to
e.g. https://snapcraft.io/lz4
If you want to test the snap before publishing you
can do:
$ snap install <snapname>.snap --dangerous
And that will install it on your local host. You
will then have lz4 as a command to run.
Installing the Snap
-------------------
Once published and released in the snapstore your snap
can be installed on any platform that supports snaps
by doing:
snap install lz4
[1] https://docs.snapcraft.io/releasing-to-the-snap-store
Add an additional BUILD_STATIC_LIBS option to control building static
libraries independently of shared. This makes it possible (if both
options are set to ON) to build both shared and static libraries
simulataneously.
A dependant option is used to preserve the current BUILD_SHARED_LIBS
behavior, i.e. -DBUILD_SHARED_LIBS=ON -- shared lib only,
-DBUILD_SHARED_LIBS=OFF -- static lib only.
The targets used to build shared and static library are split now,
and only relevant properties are passed to each of them. An alias is
used to link programs to the preferred library.
See https://github.com/lz4/lz4/pull/260 for details. PIC is enabled
by default; to disable it, define the LZ4_POSITION_INDEPENDENT_LIB
variable to ON (cmake -DLZ4_POSITION_INDEPENDENT_LIB=ON ...).
This makes it much easier to include LZ4 in a CMake-based project;
you only need to add_subdirectory(lz4/contrib/cmake_unofficial),
then you can use the lz4 target (which is the library). In bundled
mode a static library will be built and nothing will be installed,
although the lz4 and lz4c command line tools will still be built.
This also makes some other much less intrusive changes, including:
* Version information is now parsed from lib/lz4.h so the
CMakeLists.txt file no longer needs to manually be kept up to date
manually.
* pkg-config file uses ${prefix} where appropriate instead of writing
out full paths, which is important for people on Windows.
* Warning flags are now checked instead of blindly added.
* The GNUInstallDirs module is used to determine installation
locations.
* The static library generates position independent code, which means
it's usable when building a shared library.
* The CLI tools link to liblz4 instead of duplicating the object code.