Skip to content

Commit

Permalink
build: 🛠️ 改进 CMake 中 clock_gettime 的兼容性检查 (#623)
Browse files Browse the repository at this point in the history
Co-authored-by: Tayne <[email protected]>
  • Loading branch information
tayne3 and Tayne authored Sep 12, 2024
1 parent 06372ab commit 0cfc3c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ check_function("socketpair" "sys/socket.h")
check_function("eventfd" "sys/eventfd.h")
check_function("setproctitle" "unistd.h")

if (NOT HAVE_CLOCK_GETTIME)
include(CheckLibraryExists)
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME_IN_RT)
if (HAVE_CLOCK_GETTIME_IN_RT)
set(HAVE_CLOCK_GETTIME ${HAVE_CLOCK_GETTIME_IN_RT})
endif()
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hconfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/hconfig.h)

# see Makefile.in
Expand Down

0 comments on commit 0cfc3c1

Please sign in to comment.