FindBZip2 — CMake 4.2.6 Documentation

# FindBZip2

Finds the BZip2 data compression library (libbz2):

    find_package(BZip2 [<version>] [...])

## Imported Targets

This module provides the following Imported Targets:

`BZip2::BZip2`

  Added in version 3.12.

  Target encapsulating the usage requirements of BZip2 library. This target is available only when BZip2 is found.

## Result Variables

This module defines the following variables:

`BZip2_FOUND`

  Added in version 3.3.

  Boolean indicating whether the (requested version of) BZip2 library was found.

`BZip2_VERSION`

  Added in version 4.2.

  The version of BZip2 found.

`BZIP2_INCLUDE_DIRS`

  Added in version 3.12.

  Include directories needed to use BZip2 library.

`BZIP2_LIBRARIES`

  Libraries needed for linking to use BZip2.

## Cache Variables

The following cache variables may also be set:

`BZIP2_INCLUDE_DIR`

  The directory containing the BZip2 headers.

`BZIP2_LIBRARY_RELEASE`

  The path to the BZip2 library for release configurations.

`BZIP2_LIBRARY_DEBUG`

  The path to the BZip2 library for debug configurations.

`BZIP2_NEED_PREFIX`

  Boolean indicating whether BZip2 functions are prefixed with `BZ2_` (e.g., `BZ2_bzCompressInit()`). Versions of BZip2 prior to 1.0.0 used unprefixed function names (e.g., `bzCompressInit()`).

## Deprecated Variables

The following variables are provided for backward compatibility:

`BZIP2_FOUND`

  Deprecated since version 4.2: Use `BZip2_FOUND`, which has the same value.

  Boolean indicating whether the (requested version of) BZip2 library was found.

`BZIP2_VERSION_STRING`

  Deprecated since version 3.26: Superseded by the `BZIP2_VERSION` (and `BZip2_VERSION`).

  The version of BZip2 found.

`BZIP2_VERSION`

  Added in version 3.26.

  Deprecated since version 4.2: Superseded by the `BZip2_VERSION`.

  The version of BZip2 found.

## Examples

Finding BZip2 library and linking it to a project target:

    find_package(BZip2)
    target_link_libraries(project_target PRIVATE BZip2::BZip2)