aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/CheckFileOffsetBits.cmake
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-11-12 18:12:26 +0100
committerSven Gothel <[email protected]>2015-11-12 18:12:26 +0100
commit542c4804aafe3f3879cee56d19d7353ed49ee154 (patch)
tree9c89aeda9ec5d368a1fb016422448e6418fc87db /cmake/CheckFileOffsetBits.cmake
parent2e8f6a1704dfa0048dbfc2f826847a4aaea3cbe8 (diff)
parent5d039309b355c350fd087a48c4b896d31871d174 (diff)
Merge branch 'UPSTREAM'
Diffstat (limited to 'cmake/CheckFileOffsetBits.cmake')
-rw-r--r--cmake/CheckFileOffsetBits.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/CheckFileOffsetBits.cmake b/cmake/CheckFileOffsetBits.cmake
new file mode 100644
index 00000000..1dc154e4
--- /dev/null
+++ b/cmake/CheckFileOffsetBits.cmake
@@ -0,0 +1,39 @@
+# - Check if the _FILE_OFFSET_BITS macro is needed for large files
+# CHECK_FILE_OFFSET_BITS()
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# Copyright (c) 2009, Chris Robinson
+#
+# Redistribution and use is allowed according to the terms of the LGPL license.
+
+
+MACRO(CHECK_FILE_OFFSET_BITS)
+
+ IF(NOT DEFINED _FILE_OFFSET_BITS)
+ MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files")
+ TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckFileOffsetBits.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
+ IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
+ TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckFileOffsetBits.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
+ ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
+
+ IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+ SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
+ MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - 64")
+ ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+ SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
+ MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed")
+ ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+ ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
+
+ENDMACRO(CHECK_FILE_OFFSET_BITS) \ No newline at end of file