2018-11-05 13:18:57 +00:00
|
|
|
include(CheckCXXSourceCompiles)
|
2019-02-12 15:04:57 +00:00
|
|
|
include(CMakePushCheckState)
|
2018-11-05 13:18:57 +00:00
|
|
|
|
|
|
|
find_library(LIBRT rt)
|
|
|
|
|
2019-02-12 15:04:57 +00:00
|
|
|
cmake_push_check_state()
|
2018-11-05 13:18:57 +00:00
|
|
|
if(LIBRT_FOUND)
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBRT}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
timespec ts; clock_gettime(CLOCK_REALTIME, &ts);
|
|
|
|
}" HAVE_GETTIME)
|
|
|
|
|
2019-02-12 15:04:57 +00:00
|
|
|
cmake_pop_check_state()
|
2018-11-05 13:18:57 +00:00
|
|
|
|
|
|
|
add_library(WrapRt INTERFACE)
|
|
|
|
if (LIBRT_FOUND)
|
|
|
|
target_link_libraries(WrapRt INTERFACE "${LIBRT}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(WrapRt_FOUND "${HAVE_GETTIME}")
|
|
|
|
|