From 9472e7e15268f7022931dfa3f354cf692c89d8b5 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 9 Sep 2023 15:51:11 +0200 Subject: [PATCH] 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 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ee7c0b4c96f..064888524969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()