Skip to content

Commit

Permalink
Try to use system xz library
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jun 27, 2023
1 parent fef16fb commit 412ac11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,9 @@ ENDIF()

if ( ENABLE_XZ )
option(BUILD_TESTING "" OFF)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/xz)
find_package(LibLZMA QUIET)
if (NOT LIBLZMA_FOUND)
message( WARNING "Could not found system xz library. Using embedded xz library.")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/xz)
endif()
ENDIF()
9 changes: 7 additions & 2 deletions sources/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ target_link_libraries(hyperhdr-api
)

if(ENABLE_XZ)
target_link_libraries(hyperhdr-api liblzma)
target_include_directories(hyperhdr-api PRIVATE "${CMAKE_SOURCE_DIR}/dependencies/external/xz/src/liblzma/api")
if (NOT LIBLZMA_FOUND)
target_link_libraries(hyperhdr-api liblzma)
target_include_directories(hyperhdr-api PRIVATE "${CMAKE_SOURCE_DIR}/dependencies/external/xz/src/liblzma/api")
else()
target_link_libraries(hyperhdr-api LibLZMA::LibLZMA)
target_include_directories(hyperhdr-api PRIVATE ${LIBLZMA_INCLUDE_DIR})
endif()
endif()

if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
Expand Down
6 changes: 5 additions & 1 deletion sources/hyperhdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ if (USE_STATIC_QT_PLUGINS)
endif()

if(ENABLE_XZ)
target_link_libraries(hyperhdr liblzma)
if (LIBLZMA_FOUND)
target_link_libraries(hyperhdr LibLZMA::LibLZMA)
else()
target_link_libraries(hyperhdr liblzma)
endif()
endif()

if (ENABLE_PROTOBUF)
Expand Down

0 comments on commit 412ac11

Please sign in to comment.