8000 cmake: detect stat struct before nsec option · libgit2/libgit2@76be185 · GitHub
[go: up one dir, main page]

Skip to content

Commit 76be185

Browse files
author
Edward Thomson
committed
cmake: detect stat struct before nsec option
1 parent b6376d9 commit 76be185

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

CMakeLists.txt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ INCLUDE(CheckSymbolExists)
3131
INCLUDE(CheckStructHasMember)
3232
INCLUDE(AddCFlagIfSupported)
3333
INCLUDE(FindPkgConfig)
34+
INCLUDE(FindStatNsec)
3435

3536
# Build options
3637
#
@@ -103,23 +104,6 @@ IF(MSVC)
103104
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
104105
ENDIF()
105106

106-
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h"
107-
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
108-
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
109-
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
110-
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h
111-
HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
112-
113-
IF (HAVE_STRUCT_STAT_ST_MTIM)
114-
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
115-
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
116-
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
117-
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
118-
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
119-
ELSE ()
120-
SET( HAVE_STRUCT_STAT_NSEC ON )
121-
ENDIF()
122-
123107
# This variable will contain the libraries we need to put into
124108
# libgit2.pc's Requires.private. That is, what we're linking to or
125109
# what someone who's statically linking us needs to link to.

cmake/Modules/FindStatNsec.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h"
2+
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
3+
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
4+
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
5+
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h
6+
HAVE_STRUCT_STAT_MTIME_NSEC LANGUAG 6B81 E C)
7+
8+
IF (HAVE_STRUCT_STAT_ST_MTIM)
9+
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
10+
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
11+
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
12+
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
13+
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
14+
ELSE ()
15+
SET( HAVE_STRUCT_STAT_NSEC ON )
16+
ENDIF()

0 commit comments

Comments
 (0)
0