From 36fabdbe67c8a8fbdc3ac695a91fc443a1328cc4 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 27 Sep 2023 00:58:17 +0300 Subject: CMake: Use -D_FILE_OFFSET_BITS=64 if (and only if) needed. A CMake option LARGE_FILE_SUPPORT is created if and only if -D_FILE_OFFSET_BITS=64 affects sizeof(off_t). This is needed on many 32-bit platforms and even with 64-bit builds with MinGW-w64 to get support for files larger than 2 GiB. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f8eeebd3..b214d71d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,6 @@ # # On some platforms this builds also xz and xzdec, but these are # highly experimental and meant for testing only: -# - No large file support on those 32-bit platforms that need it # - No replacement getopt_long(), libc must have it # - No sandboxing support # - No translations @@ -53,6 +52,7 @@ include(CheckIncludeFile) include(CheckSymbolExists) include(CheckStructHasMember) include(CheckCSourceCompiles) +include(cmake/tuklib_large_file_support.cmake) include(cmake/tuklib_integer.cmake) include(cmake/tuklib_cpucores.cmake) include(cmake/tuklib_physmem.cmake) @@ -152,6 +152,11 @@ add_compile_definitions( # it also adds the definitions to CMAKE_REQUIRED_DEFINITIONS. tuklib_use_system_extensions(ALL) +# Check for large file support. It's required on some 32-bit platforms and +# even on 64-bit MinGW-w64 to get 64-bit off_t. This can be forced off on +# the CMake command line if needed: -DLARGE_FILE_SUPPORT=OFF +tuklib_large_file_support(ALL) + # This is needed by liblzma and xz. tuklib_integer(ALL) -- cgit v1.2.3