FindLibArchive — CMake 4.2.6 Documentation

# FindLibArchive

Finds the libarchive library and include directories:

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

Libarchive is a multi-format archive and compression library.

## Imported Targets

This module provides the following Imported Targets:

`LibArchive::LibArchive`

  Added in version 3.17.

  A target encapsulating the libarchive usage requirements, available only if libarchive is found.

## Result Variables

This module defines the following variables:

`LibArchive_FOUND`

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

`LibArchive_VERSION`

  A 3-component version string (`major.minor.patch`) of libarchive found.

  Added in version 3.6: Support for a new libarchive version string format. Starting from libarchive version 3.2, a different preprocessor macro is used in the header to define the version. In CMake 3.5 and earlier, this variable will be set only for libarchive versions 3.1 and earlier. In CMake 3.6 and newer, this variable will be set for all libarchive versions.

`LibArchive_INCLUDE_DIRS`

  Include search path for using libarchive.

`LibArchive_LIBRARIES`

  Libraries to link against libarchive.

## Examples

Finding libarchive and linking it to a project target:

    find_package(LibArchive)
    target_link_libraries(project_target PRIVATE LibArchive::LibArchive)