aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-27 00:58:17 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-10-26 21:46:06 +0300
commit597f49b61475438a43a417236989b2acc968a686 (patch)
tree3335bd67f83c2fb7cf41d93ec1b01b4a2129a66e /CMakeLists.txt
parentCMake: Generate and install liblzma.pc if not using MSVC. (diff)
downloadxz-597f49b61475438a43a417236989b2acc968a686.tar.xz
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0437d7fb..61ff9d94 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 translations
#
# Other missing things:
@@ -51,6 +50,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)
@@ -150,6 +150,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)