Commit df54c7fb02b8bcdc6441f38dbf783cd344575f77

Patrick Steinhardt 2019-06-27T07:34:43

cmake: report whether we are using sub-second stat information Depending on the platform and on build options, we may or may not build libgit2 with support for nanoseconds when using `stat` calls. It's currently unclear though whether sub-second stat information is used at all. Add feature info for this to tell at configure time whether it's being used or not.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/cmake/Modules/FindStatNsec.cmake b/cmake/Modules/FindStatNsec.cmake
index fa550a2..a4a09fa 100644
--- a/cmake/Modules/FindStatNsec.cmake
+++ b/cmake/Modules/FindStatNsec.cmake
@@ -1,3 +1,5 @@
+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"
@@ -17,4 +19,8 @@ ENDIF()
 
 IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
 	OPTION( USE_NSEC		"Care about sub-second file mtimes and ctimes"	ON  )
+ELSE()
+	SET(USE_NSEC OFF)
 ENDIF()
+
+ADD_FEATURE_INFO(nanoseconds USE_NSEC "whether to use sub-second file mtimes and ctimes")