summaryrefslogtreecommitdiffstats
path: root/cmake/FindStatNsec.cmake
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cmake/FindStatNsec.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/FindStatNsec.cmake b/cmake/FindStatNsec.cmake
new file mode 100644
index 0000000..9dfdf51
--- /dev/null
+++ b/cmake/FindStatNsec.cmake
@@ -0,0 +1,20 @@
+include(FeatureSummary)
+
+check_struct_has_member("struct stat" st_mtim "sys/types.h;sys/stat.h"
+ HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
+check_struct_has_member("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
+ HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
+check_struct_has_member("struct stat" st_mtime_nsec sys/stat.h
+ HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
+
+if(HAVE_STRUCT_STAT_ST_MTIM)
+ check_struct_has_member("struct stat" st_mtim.tv_nsec sys/stat.h
+ HAVE_STRUCT_STAT_NSEC LANGUAGE C)
+elseif(HAVE_STRUCT_STAT_ST_MTIMESPEC)
+ check_struct_has_member("struct stat" st_mtimespec.tv_nsec sys/stat.h
+ HAVE_STRUCT_STAT_NSEC LANGUAGE C)
+else()
+ set(HAVE_STRUCT_STAT_NSEC ON )
+endif()
+
+add_feature_info(nanoseconds USE_NSEC "support nanosecond precision file mtimes and ctimes")