yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Fix libzip version check

This commit is contained in:
Markus Wick 2020-05-09 11:14:47 +02:00
parent c5c60e04dd
commit ef1f596595
1 changed files with 14 additions and 11 deletions

View File

@ -28,6 +28,16 @@ find_library(LIBZIP_LIBRARY
"$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib "$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib
) )
if (LIBZIP_INCLUDE_DIR_ZIPCONF)
FILE(READ "${LIBZIP_INCLUDE_DIR_ZIPCONF}/zipconf.h" _LIBZIP_VERSION_CONTENTS)
if (_LIBZIP_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" LIBZIP_VERSION "${_LIBZIP_VERSION_CONTENTS}")
endif()
unset(_LIBZIP_VERSION_CONTENTS)
endif()
set(LIBZIP_VERSION ${LIBZIP_VERSION} CACHE STRING "Version number of libzip")
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libzip find_package_handle_standard_args(Libzip
FOUND_VAR LIBZIP_FOUND FOUND_VAR LIBZIP_FOUND
@ -35,19 +45,10 @@ find_package_handle_standard_args(Libzip
LIBZIP_LIBRARY LIBZIP_LIBRARY
LIBZIP_INCLUDE_DIR LIBZIP_INCLUDE_DIR
LIBZIP_INCLUDE_DIR_ZIPCONF LIBZIP_INCLUDE_DIR_ZIPCONF
LIBZIP_VERSION
VERSION_VAR LIBZIP_VERSION
) )
set(LIBZIP_VERSION 0)
if (LIBZIP_INCLUDE_DIR_ZIPCONF)
FILE(READ "${LIBZIP_INCLUDE_DIR_ZIPCONF}/zipconf.h" _LIBZIP_VERSION_CONTENTS)
if (_LIBZIP_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" LIBZIP_VERSION "${_LIBZIP_VERSION_CONTENTS}")
endif()
endif()
set(LIBZIP_VERSION ${LIBZIP_VERSION} CACHE STRING "Version number of libzip")
if(LIBZIP_FOUND) if(LIBZIP_FOUND)
set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY}) set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY})
set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR}) set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR})
@ -65,5 +66,7 @@ endif()
mark_as_advanced( mark_as_advanced(
LIBZIP_INCLUDE_DIR LIBZIP_INCLUDE_DIR
LIBZIP_INCLUDE_DIR_ZIPCONF
LIBZIP_LIBRARY LIBZIP_LIBRARY
LIBZIP_VERSION
) )