summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/LargeFiles.cmake44
-rw-r--r--heimdall/CMakeLists.txt4
-rw-r--r--heimdall/source/Heimdall.h4
3 files changed, 36 insertions, 16 deletions
diff --git a/cmake/LargeFiles.cmake b/cmake/LargeFiles.cmake
index b59295a..6e60a8d 100644
--- a/cmake/LargeFiles.cmake
+++ b/cmake/LargeFiles.cmake
@@ -2,21 +2,31 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
if(NOT DEFINED ${VARIABLE})
message(STATUS "Checking if large (64-bit) file support is available...")
- if(${USE_64_SUFFIX})
+ if(USE_64_SUFFIX)
set(SUFFIX_64 "64")
- else(${USE_64_SUFFIX})
+ else(USE_64_SUFFIX)
set(SUFFIX_64 "")
- endif(${USE_64_SUFFIX})
+ endif(USE_64_SUFFIX)
# First try without any macros defined
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
- "${CMAKE_MODULE_PATH}/LargeFiles${SUFFIX_64}.c")
+ "${CMAKE_MODULE_PATH}/LargeFiles${SUFFIX_64}.c"
+ OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
+
+ if(VERBOSE_LARGE_FILES)
+ message(STATUS "Large file output (no special flags):\n${TRY_LARGE_FILES_OUTPUT}")
+ endif(VERBOSE_LARGE_FILES)
if(NOT LARGE_FILES_SUPPORTED)
# Try with C macro _FILE_OFFSET_BITS=64
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/LargeFiles${SUFFIX_64}.c"
- COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
+ COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64"
+ OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
+
+ if(VERBOSE_LARGE_FILES)
+ message(STATUS "Large file output (_FILE_OFFSET_BITS=64):\n${TRY_LARGE_FILES_OUTPUT}")
+ endif(VERBOSE_LARGE_FILES)
if(LARGE_FILES_SUPPORTED)
set(_FILE_OFFSET_BITS=64 CACHE INTERNAL "C macro _FILE_OFFSET_BITS=64 is required for 64-bit file support")
@@ -28,10 +38,15 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/LargeFiles${SUFFIX_64}.c"
- COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE${SUFFIX_64}")
+ COMPILE_DEFINITIONS "-D_LARGEFILE${SUFFIX_64}_SOURCE"
+ OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
+
+ if(VERBOSE_LARGE_FILES)
+ message(STATUS "Large file output (_LARGEFILE${SUFFIX_64}_SOURCE):\n${TRY_LARGE_FILES_OUTPUT}")
+ endif(VERBOSE_LARGE_FILES)
if(LARGE_FILES_SUPPORTED)
- set(_LARGEFILE_SOURCE${SUFFIX_64}=1 CACHE INTERNAL "C macro _LARGEFILE_SOURCE${SUFFIX_64} is required for 64-bit file support")
+ set(_LARGEFILE${SUFFIX_64}_SOURCE=1 CACHE INTERNAL "C macro _LARGEFILE${SUFFIX_64}_SOURCE is required for 64-bit file support")
endif(LARGE_FILES_SUPPORTED)
endif(NOT LARGE_FILES_SUPPORTED)
@@ -39,11 +54,16 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
# Try with both C macro _FILE_OFFSET_BITS=64 and _LARGEFILE_SOURCE
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/LargeFiles${SUFFIX_64}.c"
- COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE${SUFFIX_64}")
+ COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE${SUFFIX_64}_SOURCE"
+ OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
+
+ if(VERBOSE_LARGE_FILES)
+ message(STATUS "Large file output (_FILE_OFFSET_BITS=64 and _LARGEFILE${SUFFIX_64}_SOURCE):\n${TRY_LARGE_FILES_OUTPUT}")
+ endif(VERBOSE_LARGE_FILES)
if(LARGE_FILES_SUPPORTED)
set(_FILE_OFFSET_BITS=64 CACHE INTERNAL "C macro _FILE_OFFSET_BITS=64 is required for 64-bit file support")
- set(_LARGEFILE_SOURCE${SUFFIX_64}=1 CACHE INTERNAL "C macro _LARGEFILE_SOURCE${SUFFIX_64} is required for 64-bit file support")
+ set(_LARGEFILE${SUFFIX_64}_SOURCE=1 CACHE INTERNAL "C macro _LARGEFILE${SUFFIX_64}_SOURCE is required for 64-bit file support")
endif(LARGE_FILES_SUPPORTED)
endif(NOT LARGE_FILES_SUPPORTED)
@@ -77,10 +97,10 @@ macro(use_large_files TARGET USE_64_SUFFIX)
APPEND PROPERTY COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
endif(DEFINED _LARGEFILE_SOURCE)
- if(DEFINED _LARGEFILE_SOURCE64)
+ if(DEFINED _LARGEFILE64_SOURCE)
set_property(TARGET ${TARGET}
- APPEND PROPERTY COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE64")
- endif(DEFINED _LARGEFILE_SOURCE64)
+ APPEND PROPERTY COMPILE_DEFINITIONS "-D_LARGEFILE64_SOURCE")
+ endif(DEFINED _LARGEFILE64_SOURCE)
else(USING_LARGE_FILES)
message(FATAL_ERROR "Large file support not available")
endif(USING_LARGE_FILES)
diff --git a/heimdall/CMakeLists.txt b/heimdall/CMakeLists.txt
index a66a336..bbb72d3 100644
--- a/heimdall/CMakeLists.txt
+++ b/heimdall/CMakeLists.txt
@@ -77,7 +77,7 @@ set(HEIMDALL_SOURCE_FILES
source/VersionAction.h)
include(LargeFiles)
-use_large_files(heimdall YES)
+use_large_files(heimdall false)
add_executable(heimdall ${HEIMDALL_SOURCE_FILES})
target_link_libraries(heimdall PRIVATE pit)
@@ -86,5 +86,5 @@ LINK_DIRECTORIES(../libusb-1.0/lib/mingw)
if(WIN32)
target_link_libraries(heimdall PRIVATE ${CMAKE_SOURCE_DIR}/libusb-1.0/lib/mingw/libusb-1.0.a)
else(WIN32)
- target_link_libraries(heimdalll PRIVATE usb-1.0)
+ target_link_libraries(heimdall PRIVATE usb-1.0)
endif(WIN32)
diff --git a/heimdall/source/Heimdall.h b/heimdall/source/Heimdall.h
index 45d0cbd..205f01d 100644
--- a/heimdall/source/Heimdall.h
+++ b/heimdall/source/Heimdall.h
@@ -48,8 +48,8 @@
#define FileOpen(FILE, MODE) fopen(FILE, MODE)
#define FileClose(FILE) fclose(FILE)
-#define FileSeek(FILE, OFFSET, ORIGIN) fseeko64(FILE, OFFSET, ORIGIN)
-#define FileTell(FILE) ftello64(FILE)
+#define FileSeek(FILE, OFFSET, ORIGIN) fseeko(FILE, OFFSET, ORIGIN)
+#define FileTell(FILE) ftello(FILE)
#define FileRewind(FILE) rewind(FILE)
#endif