🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.8 KiB

  1. # - Check if the _FILE_OFFSET_BITS macro is needed for large files
  2. # CHECK_FILE_OFFSET_BITS()
  3. #
  4. # The following variables may be set before calling this macro to
  5. # modify the way the check is run:
  6. #
  7. # CMAKE_REQUIRED_FLAGS = string of compile command line flags
  8. # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
  9. # CMAKE_REQUIRED_INCLUDES = list of include directories
  10. # Copyright (c) 2009, Chris Robinson
  11. #
  12. # Redistribution and use is allowed according to the terms of the LGPL license.
  13. MACRO(CHECK_FILE_OFFSET_BITS)
  14. IF(NOT DEFINED _FILE_OFFSET_BITS)
  15. MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files")
  16. TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
  17. ${CMAKE_CURRENT_BINARY_DIR}
  18. ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckFileOffsetBits.c
  19. COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
  20. IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
  21. TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
  22. ${CMAKE_CURRENT_BINARY_DIR}
  23. ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckFileOffsetBits.c
  24. COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
  25. ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
  26. IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
  27. SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
  28. MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - 64")
  29. ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
  30. SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
  31. MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed")
  32. ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
  33. ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
  34. ENDMACRO(CHECK_FILE_OFFSET_BITS)