]> git.proxmox.com Git - libgit2.git/blob - cmake/FindStatNsec.cmake
a4a09fa812061cfa5a2cb2332082fbec44f2b9b5
[libgit2.git] / cmake / FindStatNsec.cmake
1 INCLUDE(FeatureSummary)
2
3 CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h"
4 HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
5 CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
6 HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
7 CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h
8 HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
9
10 IF (HAVE_STRUCT_STAT_ST_MTIM)
11 CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
12 HAVE_STRUCT_STAT_NSEC LANGUAGE C)
13 ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
14 CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
15 HAVE_STRUCT_STAT_NSEC LANGUAGE C)
16 ELSE ()
17 SET( HAVE_STRUCT_STAT_NSEC ON )
18 ENDIF()
19
20 IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
21 OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON )
22 ELSE()
23 SET(USE_NSEC OFF)
24 ENDIF()
25
26 ADD_FEATURE_INFO(nanoseconds USE_NSEC "whether to use sub-second file mtimes and ctimes")