diff options
author | Chris Robinson <[email protected]> | 2016-10-04 17:19:47 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-10-04 17:19:47 -0700 |
commit | bb6fba2183a2f12d47a81c761936bc7b86dab848 (patch) | |
tree | 8276b60c503050885e7c1f982414d9c63cb287a7 /CMakeLists.txt | |
parent | 422f065809d4a93ce3294f50661ad877d8f97486 (diff) |
Properly check for struct timespec
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d4b4b626..cf6d7ca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) |