diff options
author | T.J. Corona <tj.corona@kitware.com> | 2019-12-05 18:44:44 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2019-12-05 22:18:28 (GMT) |
commit | 30488b3b9f781e614a9115d0d3dc03f164331332 (patch) | |
tree | e11710b403428e8f8e438ac7ea7c32a0cbb62f36 /Modules/FindLibArchive.cmake | |
parent | 84551652396e4e57c1833f0ef3dfe0941d14f709 (diff) | |
download | CMake-30488b3b9f781e614a9115d0d3dc03f164331332.zip CMake-30488b3b9f781e614a9115d0d3dc03f164331332.tar.gz CMake-30488b3b9f781e614a9115d0d3dc03f164331332.tar.bz2 |
FindLibArchive: create a target
Diffstat (limited to 'Modules/FindLibArchive.cmake')
-rw-r--r-- | Modules/FindLibArchive.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake index ef27b7d..ce3c8b8 100644 --- a/Modules/FindLibArchive.cmake +++ b/Modules/FindLibArchive.cmake @@ -16,18 +16,26 @@ The module defines the following variables: LibArchive_INCLUDE_DIRS - include search path LibArchive_LIBRARIES - libraries to link LibArchive_VERSION - libarchive 3-component version number + +The module defines the following ``IMPORTED`` targets: + +:: + + LibArchive::LibArchive - target for linking against libarchive #]=======================================================================] find_path(LibArchive_INCLUDE_DIR NAMES archive.h PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/include" + DOC "libarchive include directory" ) find_library(LibArchive_LIBRARY NAMES archive libarchive PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/lib" + DOC "libarchive library" ) mark_as_advanced(LibArchive_INCLUDE_DIR LibArchive_LIBRARY) @@ -58,4 +66,11 @@ unset(LIBARCHIVE_FOUND) if(LibArchive_FOUND) set(LibArchive_INCLUDE_DIRS ${LibArchive_INCLUDE_DIR}) set(LibArchive_LIBRARIES ${LibArchive_LIBRARY}) + + if (NOT TARGET LibArchive::LibArchive) + add_library(LibArchive::LibArchive UNKNOWN IMPORTED) + set_target_properties(LibArchive::LibArchive PROPERTIES + IMPORTED_LOCATION "${LibArchive_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LibArchive_INCLUDE_DIR}") + endif () endif() |