CMake: Avoid using fseeko64/ftello64/etc on non-Linux

off_t is always 64-bit on BSDs but Large File Support API is not supported.

ld: error: undefined symbol: fseeko64
>>> referenced by hash.c
>>>               hash.c.o:(filereader_seek) in archive lib/librcheevos.a

ld: error: undefined symbol: ftello64
>>> referenced by hash.c
>>>               hash.c.o:(filereader_tell) in archive lib/librcheevos.a

Based on https://github.com/citra-emu/citra/commit/26af2b644ce6
This commit is contained in:
Jan Beich 2023-09-09 15:51:11 +02:00
parent d18dea4f6a
commit 9472e7e152

View File

@ -425,7 +425,9 @@ if(NOT MSVC)
endif()
add_definitions(-D_XOPEN_SOURCE=700)
add_definitions(-D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1 -D_BSD_SOURCE -D_DEFAULT_SOURCE)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|SunOS" OR MINGW)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
add_definitions(-D_NETBSD_SOURCE)
endif()