CMake: Fix minizip unztell64 detection outside default library paths

MINIZIP_LIBRARIES is a bare library name, so check_function_exists linked
the probe without the directory pkg-config reported. On a prefix the linker
does not search by default the probe fails to link, HAVE_UNZTELL64 comes
back false, and the workaround below renames unztell64 to unzTell64 against
a minizip that exports the lowercase name, so libmgba fails to link.

Pass MINIZIP_LIBRARY_DIRS to the probe as -L flags. CMAKE_REQUIRED_FLAGS is
used instead of CMAKE_REQUIRED_LINK_OPTIONS because the latter needs CMake
3.14 and this project requires only 3.12.
This commit is contained in:
davey
2026-09-07 20:07:25 -07:00
committed by Vicki Pfau
parent aa6394c93c
commit 012919433e
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -48,6 +48,7 @@ Emulation fixes:
- GBA Video: Properly clear VRAM on reset (fixes mgba.io/i/3690)
Other fixes:
- 3DS: Don't detach autosave thread (fixes mgba.io/i/3561)
- CMake: Fix minizip unztell64 detection outside default library paths
- Core: Fix inconsistencies with setting game-specific overrides (fixes mgba.io/i/2963)
- Core: Don't leave initial empty state in rewind queue
- Debugger: Fix writing to specific segment in command-line debugger
+4
View File
@@ -679,7 +679,11 @@ elseif(USE_MINIZIP)
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libminizip1")
set(CMAKE_REQUIRED_LIBRARIES ${MINIZIP_LIBRARIES})
foreach(DIR IN LISTS MINIZIP_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${DIR}")
endforeach()
check_function_exists(unztell64 HAVE_UNZTELL64)
unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_LIBRARIES)
if(NOT HAVE_UNZTELL64)
add_definitions(-Dunztell64=unzTell64) # Bug in downstream minizip that some distros use