summaryrefslogtreecommitdiff
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-02-09 13:39:57 +0100
committerAndreas Schneider <asn@cryptomilk.org>2015-02-10 15:49:30 +0100
commit62b876a0b5da8c452780fd7c3b9c1d95cede3a81 (patch)
tree06b54caf7d391f4254193cb207a2a272e5aa8d71 /ConfigureChecks.cmake
parent5c864f6448d221541c1f425f3f2593061793f2da (diff)
downloadcmocka-62b876a0b5da8c452780fd7c3b9c1d95cede3a81.tar.gz
cmocka-62b876a0b5da8c452780fd7c3b9c1d95cede3a81.tar.bz2
cmocka-62b876a0b5da8c452780fd7c3b9c1d95cede3a81.zip
cmocka: Check if 'struct timespec' is available.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 761af94..7f8c11d 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -4,6 +4,7 @@ include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckCXXSourceCompiles)
+include(CheckStructHasMember)
include(TestBigEndian)
set(PACKAGE ${APPLICATION_NAME})
@@ -64,6 +65,9 @@ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(time.h HAVE_TIME_H)
check_include_file(unistd.h HAVE_UNISTD_H)
+if (HAVE_TIME_H)
+ check_struct_has_member("struct timespec" tv_sec "time.h" HAVE_STRUCT_TIMESPEC)
+endif (HAVE_TIME_H)
# FUNCTIONS
check_function_exists(calloc HAVE_CALLOC)
@@ -114,7 +118,7 @@ int main(void) {
}" HAVE_MSVC_THREAD_LOCAL_STORAGE)
endif(WIN32)
-if (HAVE_TIME_H AND HAVE_CLOCK_GETTIME)
+if (HAVE_TIME_H AND HAVE_STRUCT_TIMESPEC AND HAVE_CLOCK_GETTIME)
set(CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY})
message(STATUS "CMAKE_REQUIRED_INCLUDES=${CMAKE_REQUIRED_INCLUDES} CMAKE_REQUIRED_LIBRARIES=${CMAKE_REQUIRED_LIBRARIES}")
@@ -129,7 +133,7 @@ int main(void) {
return 0;
}" HAVE_CLOCK_GETTIME_REALTIME)
set(CMAKE_REQUIRED_INCLUDES)
-endif (HAVE_TIME_H AND HAVE_CLOCK_GETTIME)
+endif ()
# ENDIAN
if (NOT WIN32)