summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJacques Germishuys <jacquesg@striata.com>2015-11-20 18:57:13 +0200
committerJacques Germishuys <jacquesg@striata.com>2015-11-20 21:05:38 +0200
commiteb11fac629aa6acee934fc310621ed9a50a200fa (patch)
tree7adced2dc9515530e32062646cd5e885ae1abaf8 /CMakeLists.txt
parent69d1494873ee170ae33c37943c75bf7fa1c9d89d (diff)
downloadlibgit2-eb11fac629aa6acee934fc310621ed9a50a200fa.tar.gz
Detect stat's structure
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 18 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0537b19d1..0b7a03c67 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,9 +86,20 @@ IF (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
OPTION( USE_OPENSSL "Link with and use openssl library" ON )
ENDIF()
-CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
- HAVE_STRUCT_STAT_NSEC LANGUAGE C)
-IF(HAVE_STRUCT_STAT_NSEC OR WIN32)
+CHECK_STRUCT_HAS_MEMBER ("struct stat" st_atim "sys/types.h;sys/stat.h"
+ HAVE_STRUCT_STAT_ST_ATIM LANGUAGE C)
+CHECK_STRUCT_HAS_MEMBER ("struct stat" st_atimespec "sys/types.h;sys/stat.h"
+ HAVE_STRUCT_STAT_ST_ATIMESPEC LANGUAGE C)
+
+IF (HAVE_STRUCT_STAT_ST_ATIM)
+ CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
+ HAVE_STRUCT_STAT_NSEC LANGUAGE C)
+ELSEIF (HAVE_STRUCT_STAT_ST_ATIMESPEC)
+ CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
+ HAVE_STRUCT_STAT_NSEC LANGUAGE C)
+ENDIF()
+
+IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" OFF )
ENDIF()
@@ -527,6 +538,10 @@ IF (USE_NSEC)
ADD_DEFINITIONS(-DGIT_USE_NSEC)
ENDIF()
+IF (HAVE_STRUCT_STAT_ST_ATIMESPEC)
+ ADD_DEFINITIONS(-DGIT_USE_STAT_ATIMESPEC)
+ENDIF()
+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
# Collect sourcefiles