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

在 3.17 版被加入.

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

結果變數

該模組定義了以下變數:

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.

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

範例

Finding libarchive and linking it to a project target:

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