From 503d558e902a6a5f7a53ee28a4c2103f9f02c9e2 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Tue, 6 Jun 2023 01:04:51 -0400 Subject: [PATCH] Fix building on OpenBSD (#6637) Only utilize librt if its presence is detected. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64658d988..67275d9f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,7 +275,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") endif() if(UNIX AND NOT APPLE) - set(MAYBE_RT_LIBRARY -lrt) + find_library(RT_LIB rt) + if (RT_LIB) + set(MAYBE_RT_LIBRARY -lrt) + endif() endif() find_package(Threads REQUIRED)