Skip to content

Commit 2ccbf3f

Browse files
committed
CMake: Add fallback for older unarr versions without FindPackage module
1 parent 66447a4 commit 2ccbf3f

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@ set_property(CACHE OPENGL PROPERTY STRINGS "desktop" "angle" "force-angle"
7979

8080
# Handle dependencies for backends
8181
if(DECOMPRESSION_BACKEND STREQUAL "unarr")
82-
find_package("unarr" REQUIRED)
82+
find_package("unarr")
83+
# old unarr only ships PKGCONFIG
84+
if(NOT unarr_FOUND)
85+
pkg_check_modules(unarr IMPORTED_TARGET "libunarr" REQUIRED)
86+
endif()
8387
elseif(DECOMPRESSION_BACKEND STREQUAL "7zip")
8488
find_package("7zip" REQUIRED)
8589
elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive")
86-
find_package("LibArchive::LibArchive" REQUIRED)
90+
find_package("LibArchive" REQUIRED)
8791
else()
8892
message(FATAL_ERROR "No valid decompression backend specified.")
8993
endif()

compressed_archive/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ if(DECOMPRESSION_BACKEND STREQUAL "unarr")
77
unarr/extract_delegate.h)
88
target_include_directories(cbx_backend PUBLIC unarr)
99
target_compile_definitions(cbx_backend PUBLIC use_unarr)
10-
target_link_libraries(cbx_backend unarr::unarr Qt::Core)
10+
if(TARGET unarr:unarr)
11+
target_link_libraries(cbx_backend unarr::unarr Qt::Core)
12+
else()
13+
target_link_libraries(cbx_backend PkgConfig::unarr Qt::Core)
14+
endif()
1115

1216
elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive")
1317

0 commit comments

Comments
 (0)