b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | --- a/Modules/FindLibLZMA.cmake |
| 2 | +++ b/Modules/FindLibLZMA.cmake |
| 3 | @@ -61,7 +61,13 @@ The following variables are provided for |
| 4 | cmake_policy(PUSH) |
| 5 | cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n> |
| 6 | |
| 7 | -find_path(LIBLZMA_INCLUDE_DIR lzma.h ) |
| 8 | +if(UNIX) |
| 9 | + find_package(PkgConfig QUIET) |
| 10 | + pkg_search_module(PC_liblzma liblzma) |
| 11 | +endif() |
| 12 | + |
| 13 | +find_path(LIBLZMA_INCLUDE_DIR lzma.h HINTS ${PC_liblzma_INCLUDEDIR} ${PC_liblzma_INCLUDE_DIRS}) |
| 14 | +find_library(LIBLZMA_LIBRARY NAMES lzma HINTS ${PC_liblzma_LIBDIR} ${PC_liblzma_LIBRARY_DIRS}) |
| 15 | if(NOT LIBLZMA_LIBRARY) |
| 16 | find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib) |
| 17 | find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib) |