Properly check for struct timespec
This commit is contained in:
@@ -23,6 +23,7 @@ INCLUDE(CheckSymbolExists)
|
||||
INCLUDE(CheckCCompilerFlag)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
INCLUDE(CheckTypeSize)
|
||||
include(CheckStructHasMember)
|
||||
include(CheckFileOffsetBits)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -178,6 +179,13 @@ IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
# Check if we have a proper timespec declaration
|
||||
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
|
||||
IF(HAVE_STRUCT_TIMESPEC)
|
||||
# Define it here so we don't have to include config.h for it
|
||||
ADD_DEFINITIONS("-DHAVE_STRUCT_TIMESPEC")
|
||||
ENDIF()
|
||||
|
||||
# Some systems may need libatomic for C11 atomic functions to work
|
||||
SET(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES} atomic)
|
||||
|
||||
+1
-7
@@ -33,17 +33,11 @@ typedef void (*altss_dtor_t)(void*);
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#if !defined(_TIMESPEC_DEFINED) && !(defined(_MSC_VER) && (_MSC_VER >= 1900))
|
||||
#define _TIMESPEC_DEFINED
|
||||
#ifndef HAVE_STRUCT_TIMESPEC
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
struct itimerspec {
|
||||
struct timespec it_interval;
|
||||
struct timespec it_value;
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef DWORD althrd_t;
|
||||
|
||||
Reference in New Issue
Block a user