File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,12 @@ endif()
5757
5858find_package (ICU COMPONENTS uc i18n REQUIRED OPTIONAL_COMPONENTS data)
5959
60+ # This is needed if we're statically linking, otherwise we can't pull in Dispatch
61+ # because we won't have RT::rt as a CMake target.
62+ if (NOT CMAKE_SYSTEM_NAME STREQUAL Android)
63+ find_package (LibRT)
64+ endif ()
65+
6066include (SwiftSupport)
6167include (GNUInstallDirs)
6268include (XCTest)
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments