]> git.saurik.com Git - apple/libdispatch.git/blob - cmake/modules/FindLibRT.cmake
libdispatch-913.30.4.tar.gz
[apple/libdispatch.git] / cmake / modules / FindLibRT.cmake
1 #.rst:
2 # FindLibRT
3 # ---------
4 #
5 # Find librt library and headers.
6 #
7 # The mdoule defines the following variables:
8 #
9 # ::
10 #
11 # LibRT_FOUND - true if librt was found
12 # LibRT_INCLUDE_DIR - include search path
13 # LibRT_LIBRARIES - libraries to link
14
15 if(UNIX)
16 find_path(LibRT_INCLUDE_DIR
17 NAMES
18 time.h)
19 find_library(LibRT_LIBRARIES rt)
20
21 include(FindPackageHandleStandardArgs)
22 find_package_handle_standard_args(LibRT
23 REQUIRED_VARS
24 LibRT_LIBRARIES
25 LibRT_INCLUDE_DIR)
26
27 if(LibRT_FOUND)
28 if(NOT TARGET RT::rt)
29 add_library(RT::rt UNKNOWN IMPORTED)
30 set_target_properties(RT::rt
31 PROPERTIES
32 IMPORTED_LOCATION ${LibRT_LIBRARIES}
33 INTERFACE_INCLUDE_DIRECTORIES ${LibRT_INCLUDE_DIR})
34 endif()
35 endif()
36
37 mark_as_advanced(LibRT_LIBRARIES LibRT_INCLUDE_DIR)
38 endif()
39