FindLibArchive — CMake 4.1.2 Documentation

# FindLibArchive

Finds the libarchive library and include directories. Libarchive is a multi-format archive and compression library.

## Import Targets

This module defines the following Imported Targets:

`LibArchive::LibArchive`

  New in version 3.17.

  A target for linking against libarchive.

## Result Variables

This module defines the following variables:

`LibArchive_FOUND`

  Boolean indicating whether libarchive was found.

`LibArchive_INCLUDE_DIRS`

  Include search path for using libarchive.

`LibArchive_LIBRARIES`

  Libraries to link against libarchive.

`LibArchive_VERSION`

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

  New 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.

## Examples

Finding LibArchive and linking it to a project target:

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