Skip to content

Commit

Permalink
CMake: Add fallback for older unarr versions without FindPackage module
Browse files Browse the repository at this point in the history
  • Loading branch information
selmf committed Dec 3, 2023
1 parent 66447a4 commit 2ccbf3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ set_property(CACHE OPENGL PROPERTY STRINGS "desktop" "angle" "force-angle"

# Handle dependencies for backends
if(DECOMPRESSION_BACKEND STREQUAL "unarr")
find_package("unarr" REQUIRED)
find_package("unarr")
# old unarr only ships PKGCONFIG
if(NOT unarr_FOUND)
pkg_check_modules(unarr IMPORTED_TARGET "libunarr" REQUIRED)
endif()
elseif(DECOMPRESSION_BACKEND STREQUAL "7zip")
find_package("7zip" REQUIRED)
elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive")
find_package("LibArchive::LibArchive" REQUIRED)
find_package("LibArchive" REQUIRED)
else()
message(FATAL_ERROR "No valid decompression backend specified.")
endif()
Expand Down
6 changes: 5 additions & 1 deletion compressed_archive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ if(DECOMPRESSION_BACKEND STREQUAL "unarr")
unarr/extract_delegate.h)
target_include_directories(cbx_backend PUBLIC unarr)
target_compile_definitions(cbx_backend PUBLIC use_unarr)
target_link_libraries(cbx_backend unarr::unarr Qt::Core)
if(TARGET unarr:unarr)
target_link_libraries(cbx_backend unarr::unarr Qt::Core)
else()
target_link_libraries(cbx_backend PkgConfig::unarr Qt::Core)
endif()

elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive")

Expand Down

0 comments on commit 2ccbf3f

Please sign in to comment.