Cargo Features

[dependencies]
libz-sys = { version = "1.1.20", default-features = false, features = ["zlib-ng", "zlib-ng-no-cmake-experimental-community-maintained", "stock-zlib", "asm", "static"] }
default = libc, stock-zlib

These default features are set whenever libz-sys is added without default-features = false somewhere in the dependency tree.

zlib-ng = cmake, libc

(Omit the libc feature if you don't require the corresponding functions.)

This allows higher-level crates depending on your library to opt into zlib-ng if desired.

zlib-ng-no-cmake-experimental-community-maintained = libc

Builds zlib-ng from source using cc instead of cmake with all target features enabled, meaning compilation may not work depending on your target and host toolchain (eg very old compilers won't have some flags)

This feature is not maintained by the repo maintainers and can break at any time or be completely removed in the future

stock-zlib default
asm

Deprecated: the assembly routines are outdated, and either reduce performance or cause segfaults.

static

Enable this feature if you want to have a statically linked libz

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

libc default zlib-ng? zlib-ng-no…community-maintained?

Enables libc

When this feature is disabled, zlib will be built in Z_SOLO mode which removes dependency on any external libraries like libc at the cost of eliminating some high-level functions like gz*, compress* and uncompress, and requiring embedder to provide memory allocation routines to deflate and inflate.

Affects libz-sys::gzFile, libz-sys::gzFile_s, libz-sys::z_off_t, libz-sys::z_off_t

cmake build zlib-ng?