Move cmake includes required by SelectRTBackend
[umurmur.git] / cmake / Modules / SelectRTBackend.cmake
1 include(CheckLibraryExists)
2 include(CheckFunctionExists)
3
4 function(SelectRTBackend)
5   check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
6
7   if(NOT HAVE_CLOCK_GETTIME_RT)
8     check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
9     if(NOT HAVE_CLOCK_GETTIME)
10       check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
11       if(NOT HAVE_CLOCK_GET_TIME)
12         message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time()!")
13       endif()
14     endif()
15   else()
16     set(LIBRT rt PARENT_SCOPE)
17   endif()
18 endfunction()