]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #.rst: |
2 | # FindLibRt | |
3 | # -------- | |
4 | # | |
5 | # Find the native realtime includes and library. | |
6 | # | |
7 | # IMPORTED Targets | |
8 | # ^^^^^^^^^^^^^^^^ | |
9 | # | |
10 | # This module defines :prop_tgt:`IMPORTED` target ``LIBRT::LIBRT``, if | |
11 | # LIBRT has been found. | |
12 | # | |
13 | # Result Variables | |
14 | # ^^^^^^^^^^^^^^^^ | |
15 | # | |
16 | # This module defines the following variables: | |
17 | # | |
18 | # :: | |
19 | # | |
20 | # LIBRT_INCLUDE_DIRS - where to find time.h, etc. | |
21 | # LIBRT_LIBRARIES - List of libraries when using librt. | |
22 | # LIBRT_FOUND - True if realtime library found. | |
23 | # | |
24 | # Hints | |
25 | # ^^^^^ | |
26 | # | |
27 | # A user may set ``LIBRT_ROOT`` to a realtime installation root to tell this | |
28 | # module where to look. | |
29 | ||
30 | find_path(LIBRT_INCLUDE_DIRS | |
31 | NAMES time.h | |
32 | PATHS ${LIBRT_ROOT}/include/ | |
33 | ) | |
34 | find_library(LIBRT_LIBRARIES rt) | |
35 | include(FindPackageHandleStandardArgs) | |
36 | find_package_handle_standard_args(LibRt DEFAULT_MSG LIBRT_LIBRARIES LIBRT_INCLUDE_DIRS) | |
37 | mark_as_advanced(LIBRT_INCLUDE_DIRS LIBRT_LIBRARIES) | |
38 | ||
39 | if(LIBRT_FOUND) | |
40 | if(NOT TARGET LIBRT::LIBRT) | |
41 | add_library(LIBRT::LIBRT UNKNOWN IMPORTED) | |
42 | set_target_properties(LIBRT::LIBRT PROPERTIES | |
43 | IMPORTED_LOCATION "${LIBRT_LIBRARIES}" | |
44 | INTERFACE_INCLUDE_DIRECTORIES "${LIBRT_INCLUDE_DIRS}") | |
45 | endif() | |
46 | endif() |