blob: 4b8ec0d33f55bfbe5cccdc1705fc1c83dec96b08 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- 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)