1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00
transmission/cmake/LargeFileSupport.cmake
Mike Gelfand bc380511db
Modernize CMake code (ongoing refactoring) (#4507)
* Reformat CMake code

* Bump minimum CMake version to 3.12

* Add target sources separately via `target_source()`

* Make `tr_win32_app_info()` add target sources on its own

* Don't use `include_directories()`

* Don't use `add_definitions()`

* Limit use of `add_compile_options()`

* Move VDKQueue target declaration to a subdirectory

* Add `tr_disable_source_files_compile()` helper

* Add `tr_target_glib_resources()` helper

* Add `tr_gettext_msgfmt()` helper

* Enable AUTOUIC for Qt client

* Enable AUTORCC for Qt client

* Remove AUTO{MOC,RCC,UIC} source group overrides

* Add `tr_target_idl_files()` helper

* Move source group setup to `tr_qt_add_translation()`

* Add `tr_target_xib_files()` helper

* Prefer `target_sources()` to intermediate variables

* Use explicit visibility versions of `target_*()` commands

* Prefer genexes to conditions in `target_*()` commands

* Add `tr_allow_compile_if()` helper

* Leave only top-level `project()`, remove the rest

* Minor fixups

* Fixup Mac QL plugin install

* Fixup IDE target folders and source groups
2023-01-01 19:49:48 +00:00

35 lines
1.3 KiB
CMake

# Based on AC_SYS_LARGEFILE
if(NOT DEFINED NO_LFS_MACROS_REQUIRED)
include(CheckCSourceCompiles)
# Check that off_t can represent 2**63 - 1 correctly.
# We can't simply define LARGE_OFF_T to be 9223372036854775807,
# since some C++ compilers masquerading as C compilers
# incorrectly reject 9223372036854775807.
set(LFS_TEST_PROGRAM
"#include <sys/types.h>
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];
int main() { return 0; }")
check_c_source_compiles("${LFS_TEST_PROGRAM}" NO_LFS_MACROS_REQUIRED)
if(NOT NO_LFS_MACROS_REQUIRED)
if(NOT DEFINED FILE_OFFSET_BITS_LFS_MACRO_REQUIRED)
check_c_source_compiles("#define _FILE_OFFSET_BITS 64 ${LFS_TEST_PROGRAM}" FILE_OFFSET_BITS_LFS_MACRO_REQUIRED)
if(NOT FILE_OFFSET_BITS_LFS_MACRO_REQUIRED AND NOT DEFINED LARGE_FILES_LFS_MACRO_REQUIRED)
check_c_source_compiles("#define _LARGE_FILES 1 ${LFS_TEST_PROGRAM}" LARGE_FILES_LFS_MACRO_REQUIRED)
endif()
endif()
endif()
unset(LFS_TEST_PROGRAM)
endif()
if(FILE_OFFSET_BITS_LFS_MACRO_REQUIRED)
add_definitions(-D_FILE_OFFSET_BITS=64)
endif()
if(LARGE_FILES_LFS_MACRO_REQUIRED)
add_definitions(-D_LARGE_FILES=1)
endif()