CMake: Fix build with libzip 1.7

This commit is contained in:
Vicki Pfau 2020-07-12 00:21:42 -07:00
parent 73c38b95b6
commit 9295c3c893
2 changed files with 9 additions and 4 deletions

View File

@ -30,6 +30,7 @@ Other fixes:
- All: Improve export headers (fixes mgba.io/i/1738)
- All: Correct format strings for some numbers on Windows (fixes mgba.io/i/1794)
- All: Correct more format strings on Windows (fixes mgba.io/i/1817)
- CMake: Fix build with libzip 1.7
- Core: Ensure ELF regions can be written before trying
- Debugger: Don't skip undefined instructions when debugger attached
- FFmpeg: Fix some small memory leaks

View File

@ -631,15 +631,19 @@ if(WANT_SQLITE3 AND NOT USE_SQLITE3)
endif()
if(USE_LIBZIP)
include_directories(AFTER ${LIBZIP_INCLUDE_DIRS})
link_directories(${LIBZIP_LIBRARY_DIRS})
list(APPEND DEPENDENCY_LIB ${LIBZIP_LIBRARIES})
if(TARGET libzip::zip)
list(APPEND DEPENDENCY_LIB libzip::zip)
else()
include_directories(AFTER ${LIBZIP_INCLUDE_DIRS})
link_directories(${LIBZIP_LIBRARY_DIRS})
list(APPEND DEPENDENCY_LIB ${LIBZIP_LIBRARIES})
endif()
list(APPEND FEATURES LIBZIP)
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c)
string(REGEX MATCH "^[0-9]+" LIBZIP_VERSION_MAJOR "${libzip_VERSION}")
if (LIBZIP_VERSION_MAJOR LESS 1)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip2")
elseif(LIBZIP_VERSION_MAJOR EQUAL 1)
elseif(LIBZIP_VERSION_MAJOR EQUAL 1 OR NOT LIBZIP_VERSION_MAJOR)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip4|libzip5")
else()
message(AUTHOR_WARNING "Unknown version of libzip detected: ${libzip_VERSION}")