summaryrefslogtreecommitdiff
path: root/CompileFlags.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-09-23 18:06:35 +0200
committerBrad King <brad.king@kitware.com>2020-09-23 14:25:30 -0400
commit5b10f96793ab6f3a4ef446d67c09ea91b7898584 (patch)
tree8d6576685a699602fdb4055727dfe4754e83907f /CompileFlags.cmake
parentc9a3ae13563f1e66d90225fff98fbc207195c155 (diff)
downloadcmake-5b10f96793ab6f3a4ef446d67c09ea91b7898584.tar.gz
Linux: Compile with _FILE_OFFSET_BITS=64 on 32-bit Linux
To avoid problems accessing filesystem, use 64-bit file offsets when compilation model is 32-bit. This explicit definition is needed now that KWSys does not provide LFS settings in its headers anymore. Fixes: #20568
Diffstat (limited to 'CompileFlags.cmake')
-rw-r--r--CompileFlags.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index 053259f47c..1c5f1beca9 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -53,6 +53,12 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
endif()
endif()
+# Use 64-bit off_t on 32-bit Linux
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+ # ensure 64bit offsets are used for filesystem accesses for 32bit compilation
+ add_definitions(-D_FILE_OFFSET_BITS=64)
+endif()
+
# Workaround for TOC Overflow on ppc64
set(bigTocFlag "")
if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND