This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindLibRT.cmake
121 lines (110 loc) · 3.87 KB
/
FindLibRT.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# You may redistribute this program and/or modify it under the terms of
# the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if(NOT LIBRT_FOUND)
IF(${CMAKE_C_COMPILER} MATCHES "arm")
# We are on ARM.
find_path(LIBRT_INCLUDE_DIR
NAMES
time.h
PATHS
${LIBRTDIR}/include/
)
find_file(
LIBRT_LIBRARIES librt.a
PATHS
${LIBRTDIR}/lib/
/usr/lib/arm-linux-gnueabihf/
/usr/lib/arm-linux-gnueabi/
)
set (LIBRT_DYNAMIC "Using static library.")
if (NOT LIBRT_LIBRARIES)
find_library(
LIBRT_LIBRARIES rt
PATHS
${LIBRTDIR}/lib/
/usr/lib/arm-linux-gnueabihf/
/usr/lib/arm-linux-gnueabi/
)
set (LIBRT_DYNAMIC "Using dynamic library.")
endif (NOT LIBRT_LIBRARIES)
ELSE()
IF("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
# We are on x86_64.
find_path(LIBRT_INCLUDE_DIR
NAMES
time.h
PATHS
${LIBRTDIR}/include/
)
find_file(
LIBRT_LIBRARIES librt.a
PATHS
${LIBRTDIR}/lib/
/usr/lib/x86_64-linux-gnu/
/usr/local/lib64/
/usr/lib64/
/usr/lib/
)
set (LIBRT_DYNAMIC "Using static library.")
if (NOT LIBRT_LIBRARIES)
find_library(
LIBRT_LIBRARIES rt
PATHS
${LIBRTDIR}/lib/
/usr/lib/x86_64-linux-gnu/
/usr/local/lib64/
/usr/lib64/
/usr/lib/
)
set (LIBRT_DYNAMIC "Using dynamic library.")
endif (NOT LIBRT_LIBRARIES)
ELSE()
# We are on x86.
find_path(LIBRT_INCLUDE_DIR
NAMES
time.h
PATHS
${LIBRTDIR}/include/
)
find_file(
LIBRT_LIBRARIES librt.a
PATHS
${LIBRTDIR}/lib/
/usr/lib/i386-linux-gnu/
/usr/local/lib/
/usr/lib/
)
set (LIBRT_DYNAMIC "Using static library.")
if (NOT LIBRT_LIBRARIES)
find_library(
LIBRT_LIBRARIES rt
PATHS
${LIBRTDIR}/lib/
/usr/lib/i386-linux-gnu/
/usr/local/lib/
/usr/lib/
)
set (LIBRT_DYNAMIC "Using dynamic library.")
endif (NOT LIBRT_LIBRARIES)
ENDIF()
ENDIF()
if (LIBRT_INCLUDE_DIR AND LIBRT_LIBRARIES)
set (LIBRT_FOUND TRUE)
endif (LIBRT_INCLUDE_DIR AND LIBRT_LIBRARIES)
if (LIBRT_FOUND)
message(STATUS "Found librt: ${LIBRT_INCLUDE_DIR}, ${LIBRT_LIBRARIES} ${LIBRT_DYNAMIC}")
else (LIBRT_FOUND)
if (Librt_FIND_REQUIRED)
message (FATAL_ERROR "Could not find librt, try to setup LIBRT_PREFIX accordingly")
endif (Librt_FIND_REQUIRED)
endif (LIBRT_FOUND)
endif (NOT LIBRT_FOUND)