diff options
author | Hiroshi Miura <miurahr@linux.com> | 2018-12-11 22:31:12 (GMT) |
---|---|---|
committer | Hiroshi Miura <miurahr@linux.com> | 2018-12-13 00:40:11 (GMT) |
commit | 9644c835b38d211ee17b5de0bb0ae62fe188eca0 (patch) | |
tree | 31e0c3cef8ed3a7569e786c20f491451ac05ca7a /Modules | |
parent | cb995ddea2d633310b270e99d020fe490fff5ec7 (diff) | |
download | CMake-9644c835b38d211ee17b5de0bb0ae62fe188eca0.zip CMake-9644c835b38d211ee17b5de0bb0ae62fe188eca0.tar.gz CMake-9644c835b38d211ee17b5de0bb0ae62fe188eca0.tar.bz2 |
FindLibLZMA: add imported target
- Add imported target LibLZMA::LibLZMA
- Show found message with library path
- Add test for FindLibLZMA
Fixes: #18680, #18679
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindLibLZMA.cmake | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index 6d30e57..b7e5815 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -9,6 +9,18 @@ Find LibLZMA Find LibLZMA headers and library + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if +LibLZMA has been found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + :: LIBLZMA_FOUND - True if liblzma is found. @@ -51,17 +63,23 @@ if (LIBLZMA_LIBRARY) endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR - LIBLZMA_LIBRARY +find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY + LIBLZMA_INCLUDE_DIR LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET VERSION_VAR LIBLZMA_VERSION_STRING ) +mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) if (LIBLZMA_FOUND) set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) + if(NOT TARGET LibLZMA::LibLZMA) + add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR} + IMPORTED_LINK_INTERFACE_LANGUAGES C + IMPORTED_LOCATION ${LIBLZMA_LIBRARY}) + endif() endif () - -mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) |